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(); }
public void Dispose_ThenReadThrowsObjectDisposedException() { var stream = new ChunkedReadStream(new[] { new byte[0] }); stream.Dispose(); Assert.Throws<ObjectDisposedException>(() => stream.Read(new byte[10], 0, 10)); }