コード例 #1
0
        public void Dispose_AlsoDisposesEnumerator()
        {
            var enumeratorMock = new Mock<IEnumerator<byte[]>>();
            enumeratorMock.Setup(x => x.Dispose()).Verifiable();

            var stream = new ChunkedReadStream(enumeratorMock.Object);
            stream.Dispose();

            enumeratorMock.Verify();
        }
コード例 #2
0
 public void Dispose_ThenReadThrowsObjectDisposedException()
 {
     var stream = new ChunkedReadStream(new[] { new byte[0] });
     stream.Dispose();
     Assert.Throws<ObjectDisposedException>(() => stream.Read(new byte[10], 0, 10));
 }