public void TestMemStream() { Test s = new Test(new MemoryStream()); Assert.IsTrue(s.CanRead); Assert.IsTrue(s.CanWrite); Assert.IsTrue(s.CanSeek); Assert.IsFalse(s.CanTimeout); Assert.AreEqual(0L, s.Position); Assert.AreEqual(0L, s.Length); s.Write(new byte[1], 0, 1); Assert.AreEqual(0, s.Read(new byte[1], 0, 1)); Assert.AreEqual(1L, s.Position); s.Position = 0; Assert.AreEqual(1, s.Read(new byte[10], 0, 10)); Assert.AreEqual(1L, s.Position); s.Seek(0, SeekOrigin.Begin); Assert.AreEqual(0L, s.Position); Assert.AreEqual(1L, s.Length); s.SetLength(20); Assert.AreEqual(20L, s.Length); s.Flush(); s.Close(); s.Dispose(); }
public void TestNonExcpetionMembers() { BaseStream bs = new Test(); Assert.IsFalse(bs.CanRead); Assert.IsFalse(bs.CanWrite); Assert.IsFalse(bs.CanSeek); Assert.IsFalse(bs.CanTimeout); bs.Flush(); bs.Close(); bs.Dispose(); }