public void BufferedSkip_InvalidByteArray_UnexpectedStreamEnd() { var randomByteArray = Utilities.GetRandom <byte[]>(false); this.Encoder.Encode(randomByteArray); this.Encoder.Flush(); this.Stream.Seek(0, SeekOrigin.Begin); var buffer = new byte[this.Stream.Length - 1]; this.Stream.Read(buffer, 0, buffer.Length); using (var memoryStream = new MemoryStream(buffer)) { var decoder = new BufferedBinaryDecoder(memoryStream); Assert.ThrowsException <SerializationException>(() => decoder.SkipByteArray()); } }
public void BufferedSkip_InvalidString_UnexpectedStreamEnd() { var randomString = Utilities.GetRandom <string>(false); this.Encoder.Encode(randomString); this.Encoder.Flush(); this.Stream.Seek(0, SeekOrigin.Begin); var buffer = new byte[this.Stream.Length - 1]; this.Stream.Read(buffer, 0, buffer.Length); using (var memoryStream = new MemoryStream(buffer)) { var decoder = new BufferedBinaryDecoder(memoryStream); decoder.SkipString(); } }
public void BufferedDecode_InvalidByteArray_UnexpectedStreamEnd() { var randomByteArray = Utilities.GetRandom <byte[]>(false); this.Encoder.Encode(randomByteArray); this.Encoder.Flush(); this.Stream.Seek(0, SeekOrigin.Begin); var buffer = new byte[this.Stream.Length - 1]; this.Stream.Read(buffer, 0, buffer.Length); using (var memoryStream = new MemoryStream(buffer)) { var decoder = new BufferedBinaryDecoder(memoryStream); decoder.DecodeByteArray(); } }
public void BufferedDecode_InvalidString_UnexpectedStreamEnd() { Assert.Throws <SerializationException>(() => { var randomString = Utilities.GetRandom <string>(false); this.Encoder.Encode(randomString); this.Encoder.Flush(); this.Stream.Seek(0, SeekOrigin.Begin); var buffer = new byte[this.Stream.Length - 1]; this.Stream.Read(buffer, 0, buffer.Length); using (var memoryStream = new MemoryStream(buffer)) { var decoder = new BufferedBinaryDecoder(memoryStream); decoder.DecodeString(); } } ); }
public void BufferedSkip_InvalidByteArray_UnexpectedStreamEnd() { var randomByteArray = Utilities.GetRandom<byte[]>(false); this.Encoder.Encode(randomByteArray); this.Encoder.Flush(); this.Stream.Seek(0, SeekOrigin.Begin); var buffer = new byte[this.Stream.Length - 1]; this.Stream.Read(buffer, 0, buffer.Length); using (var memoryStream = new MemoryStream(buffer)) { var decoder = new BufferedBinaryDecoder(memoryStream); decoder.SkipByteArray(); } }
public void BufferedDecode_InvalidString_UnexpectedStreamEnd() { var randomString = Utilities.GetRandom<string>(false); this.Encoder.Encode(randomString); this.Encoder.Flush(); this.Stream.Seek(0, SeekOrigin.Begin); var buffer = new byte[this.Stream.Length - 1]; this.Stream.Read(buffer, 0, buffer.Length); using (var memoryStream = new MemoryStream(buffer)) { var decoder = new BufferedBinaryDecoder(memoryStream); decoder.DecodeString(); } }