public void from_current_sets_relative_to_current() { BufferPoolStream stream = new BufferPoolStream(BufferPool); stream.Write(new byte[500], 0, 500); stream.Seek(-2, SeekOrigin.Current); stream.Seek(1, SeekOrigin.Current); Assert.AreEqual(499, stream.Position); }
public void seeking_past_end_of_stream_throws_an_argumentexception() { BufferPoolStream stream = new BufferPoolStream(BufferPool); stream.Write(new byte[500], 0, 500); stream.Seek(501, SeekOrigin.Begin); }
public void seeking_past_end_of_stream_throws_an_argumentexception() { BufferPoolStream stream = new BufferPoolStream(BufferPool); stream.Write(new byte[500], 0, 500); Assert.Throws <ArgumentOutOfRangeException>(() => { stream.Seek(501, SeekOrigin.Begin); }); }
public void from_begin_sets_relative_to_beginning() { BufferPoolStream stream = new BufferPoolStream(BufferPool); stream.Write(new byte[500], 0, 500); stream.Seek(22, SeekOrigin.Begin); Assert.AreEqual(22, stream.Position); }
public void from_end_sets_relative_to_end() { BufferPoolStream stream = new BufferPoolStream(BufferPool); stream.Write(new byte[500], 0, 500); stream.Seek(-100, SeekOrigin.End); Assert.AreEqual(400, stream.Position); }
public void position_is_incremented() { BufferPoolStream stream = new BufferPoolStream(BufferPool); stream.Write(new byte[500], 0, 500); stream.Seek(0, SeekOrigin.Begin); Assert.AreEqual(0, stream.Position); int read = stream.Read(new byte[50], 0, 50); Assert.AreEqual(50, stream.Position); }
public void position_is_incremented() { BufferPoolStream stream = new BufferPoolStream(BufferPool); stream.Write(new byte[500], 0, 500); stream.Seek(0, SeekOrigin.Begin); Assert.AreEqual(0, stream.Position); stream.Read(new byte[50], 0, 50); Assert.AreEqual(50, stream.Position); }
public void a_negative_position_throws_an_argumentexception() { BufferPoolStream stream = new BufferPoolStream(BufferPool); stream.Seek(-1, SeekOrigin.Begin); }
public void a_negative_position_throws_an_argumentexception() { BufferPoolStream stream = new BufferPoolStream(BufferPool); Assert.Throws <ArgumentOutOfRangeException>(() => { stream.Seek(-1, SeekOrigin.Begin); }); }