public void TestHashStream() { var hash = Create(); var stream = new MemoryStream(); var hashStream = new HashStream <THash>(stream, hash); Assert.AreEqual(stream.CanRead, hashStream.CanRead); Assert.AreEqual(stream.CanWrite, hashStream.CanWrite); Assert.AreEqual(stream.CanSeek, hashStream.CanSeek); stream.Write(new byte[10], 0, 10); Assert.AreEqual(stream.Position, hashStream.Position); hashStream.Position = 0; Assert.AreEqual(0, hashStream.Position); Assert.AreEqual(stream.Position, hashStream.Position); hashStream.SetLength(5); Assert.AreEqual(stream.Length, hashStream.Length); hashStream.Flush(); hashStream.Seek(1, SeekOrigin.Begin); Assert.AreEqual(1, hashStream.Position); Assert.AreEqual(stream.Position, hashStream.Position); }