public void GetEmbeddedSource_UncompressedSource() { var doc = new TestSymDocument(new byte[] { 0, 0, 0, 0, (byte)'A', (byte)'B', (byte)'C' }); var src = doc.GetEmbeddedSource(); AssertEx.Equal(new byte[] { (byte)'A', (byte)'B', (byte)'C' }, src); }
public void GetEmbeddedSource_EmptySource() { var doc = new TestSymDocument(new byte[] { 0, 0, 0, 0 }); var src = doc.GetEmbeddedSource(); AssertEx.Equal(new byte[0], src); }
public void GetEmbeddedSource_NoSource() { var doc = new TestSymDocument(new byte[0]); var src = doc.GetEmbeddedSource(); Assert.Null(src.Array); }
public void GetEmbeddedSource_CompressedSource() { var srcBytes = Encoding.UTF8.GetBytes("Hello world!"); var doc = new TestSymDocument(GetCompressedSourceBlob(srcBytes)); var src = doc.GetEmbeddedSource(); AssertEx.Equal(srcBytes, src); }
public void GetEmbeddedSource_BadCompressedData() { var data = GetCompressedSourceBlob(new byte[] { 1, 2, 3 }); var doc = new TestSymDocument(data); data[0] = 4; Assert.Throws <InvalidDataException>(() => doc.GetEmbeddedSource()); data[0] = 2; Assert.Throws <InvalidDataException>(() => doc.GetEmbeddedSource()); data[0] = 3; doc.GetEmbeddedSource(); }
public void GetEmbeddedSource_CompressedLargeSource() { var srcBytes = new byte[1000000]; for (int i = 0; i < srcBytes.Length; i++) { srcBytes[i] = unchecked ((byte)i); } var doc = new TestSymDocument(GetCompressedSourceBlob(srcBytes)); var src = doc.GetEmbeddedSource(); AssertEx.Equal(srcBytes, src); }