public void CanReadCanWriteTest() { var readBuffer = this.Random.Next(2) == 1 ? new ReadBuffer((b, o, c) => 0, 1024) : null; var writeBuffer = this.Random.Next(2) == 1 ? new WriteBuffer((b, o, c) => { }, 1024) : null; using (var stream = new MyBufferStream(readBuffer, writeBuffer)) { Assert.AreEqual(readBuffer != null, stream.CanRead); Assert.AreEqual(writeBuffer != null, stream.CanWrite); stream.Dispose(); Assert.IsFalse(stream.CanRead); Assert.IsFalse(stream.CanWrite); } }