public void testSetPositionPastStream() { IndexedNumsStream ins = new IndexedNumsStream(10); ins.Seek(999, System.IO.SeekOrigin.End); Assert.AreEqual(ins.Position, ins.Length); }
public void testStreamLeftToRead() { IndexedNumsStream ins = new IndexedNumsStream(7); byte[] buffer = new byte[100]; ins.Seek(4, System.IO.SeekOrigin.Begin); int nBytes = ins.Read(buffer, 0, 7); Assert.AreEqual(3, nBytes); }
public void testEndOfStream() { IndexedNumsStream ins = new IndexedNumsStream(600); byte[] buffer = new byte[100]; ins.Seek(0, System.IO.SeekOrigin.End); int actual = ins.Read(buffer, 10, 10); Assert.AreEqual(0, actual); }
public void testSeekBegin() { IndexedNumsStream ins = new IndexedNumsStream(600); System.IO.SeekOrigin origin = System.IO.SeekOrigin.Begin; //1) long newPosition = ins.Seek(999, origin); Assert.AreEqual(newPosition, 600); //2) newPosition = ins.Seek(-9999, origin); Assert.AreEqual(0, newPosition); //3) //position should now be at 0. newPosition = ins.Seek(50, origin); Assert.AreEqual(50, newPosition); }