public void ReadIsCancelledOnTimeout()
        {
            var testStream    = new TestStream(true);
            var timeoutStream = new ReadTimeoutStream(testStream, _defaultTimeout);

            Assert.ThrowsAsync <OperationCanceledException>(() => timeoutStream.ReadAsync(_buffer, 0, 1));
        }
        public void StreamIsDisposedForTimeoutInAsyncReadWhenTokenIsIgnored()
        {
            var testStream    = new TestStream(true);
            var timeoutStream = new ReadTimeoutStream(testStream, _defaultTimeout);

            Assert.ThrowsAsync <OperationCanceledException>(() => timeoutStream.ReadAsync(_buffer, 0, 1));
        }
        public void ReadIsCancelledOnTimeoutWithAdditionalToken()
        {
            var testStream              = new TestStream(true);
            var timeoutStream           = new ReadTimeoutStream(testStream, _defaultTimeout);
            var cancellationTokenSource = new CancellationTokenSource();

            cancellationTokenSource.CancelAfter(1000000);

            var cancellationToken = cancellationTokenSource.Token;

            Assert.ThrowsAsync <OperationCanceledException>(() => timeoutStream.ReadAsync(_buffer, 0, 1, cancellationToken));
        }