public void SetLength() { var stream = new FastMemoryWriter(); stream.Write("JonnoJJonnoJJonnoJJonnoJ"); var newLength = 10; stream.SetLength(newLength); Assert.Equal(newLength, stream.Length); Assert.Equal(newLength, stream.Position); }
public void ReadWrongByteArray() { var bytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, }; var memory = new FastMemoryWriter(); memory.WriteByteArray(bytes); memory.SetLength(9); memory.Seek(0, SeekOrigin.Begin); var reader = new FastReader(memory); Assert.Throws <EndOfStreamException>(() => reader.ReadByteArray()); }