コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }