File contents are gzip'ed when they come back from TFS.

This commit is contained in:
Matt Burke
2015-02-02 15:48:09 -05:00
parent 795c7f1ed1
commit b948e30c10
+8 -6
View File
@@ -1,6 +1,7 @@
// Generated by git-tfs-test-builder
using System;
using System.IO;
using System.IO.Compression;
using System.Text;
using Sep.Git.Tfs.Core.TfsInterop;
using Sep.Git.Tfs.Test.Integration;
@@ -117,20 +118,21 @@ namespace Sep.Git.Tfs.Test.Fixtures
;
}
private static string Read(string itemContentHash)
private static byte[] Read(string itemContentHash)
{
if (itemContentHash == null)
return string.Empty;
return new byte[0];
using (var stream = typeof(vtccds).Assembly.GetManifestResourceStream("Sep.Git.Tfs.Test.Fixtures.vtccds." + itemContentHash))
{
if (stream == null)
throw new Exception("Fail: Can not find test file:" + itemContentHash);
using (var reader = new BinaryReader(stream))
using (var gzipReader = new GZipStream(stream, CompressionMode.Decompress))
{
//ToDo: How to convert bytes to the expected string!?!
var content = reader.ReadBytes((int)stream.Length);
return Encoding.UTF8.GetString(content);
var buffer = new MemoryStream();
gzipReader.CopyTo(buffer);
return buffer.ToArray();
}
}
}