public void GetWriteConnectionSourceAsync_should_throw_if_disposed()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);
            subject.Dispose();

            Action act = () => subject.GetWriteConnectionSourceAsync(Timeout.InfiniteTimeSpan, CancellationToken.None);

            act.ShouldThrow<ObjectDisposedException>();
        }
        public void GetReadChannelSourceAsync_should_throw_if_disposed()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);
            subject.Dispose();

            Action act = () => subject.GetReadChannelSourceAsync(CancellationToken.None);

            act.ShouldThrow<ObjectDisposedException>();
        }
Exemplo n.º 3
0
        public void GetReadChannelSourceAsync_should_throw_if_disposed()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            subject.Dispose();

            Action act = () => subject.GetReadChannelSourceAsync(CancellationToken.None);

            act.ShouldThrow <ObjectDisposedException>();
        }
        public void GetWriteConnectionSourceAsync_should_throw_if_disposed()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            subject.Dispose();

            Action act = () => subject.GetWriteConnectionSourceAsync(Timeout.InfiniteTimeSpan, CancellationToken.None);

            act.ShouldThrow <ObjectDisposedException>();
        }
        public void Disposing_of_handle_after_fork_should_not_dispose_of_connectionSource()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            var forked = subject.Fork();

            subject.Dispose();

            _readWriteBinding.DidNotReceive().Dispose();
        }
        public void Fork_should_throw_if_disposed()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            subject.Dispose();

            Action act = () => subject.Fork();

            act.ShouldThrow <ObjectDisposedException>();
        }
        public void Disposing_of_last_handle_should_dispose_of_connectioSource()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            var forked = subject.Fork();

            subject.Dispose();
            forked.Dispose();

            _readWriteBinding.Received().Dispose();
        }
        public void Disposing_of_last_handle_should_dispose_of_connectioSource()
        {
            var subject = new ReadWriteBindingHandle(_mockReadWriteBinding.Object);

            var forked = subject.Fork();

            subject.Dispose();
            forked.Dispose();

            _mockReadWriteBinding.Verify(b => b.Dispose(), Times.Once);
        }
        public void Disposing_of_fork_before_disposing_of_subject_hould_not_dispose_of_channelSource()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            var forked = subject.Fork();

            forked.Dispose();

            _readWriteBinding.DidNotReceive().Dispose();

            subject.Dispose();

            _readWriteBinding.Received().Dispose();
        }
        public void Disposing_of_fork_before_disposing_of_subject_hould_not_dispose_of_channelSource()
        {
            var subject = new ReadWriteBindingHandle(_mockReadWriteBinding.Object);

            var forked = subject.Fork();

            forked.Dispose();

            _mockReadWriteBinding.Verify(b => b.Dispose(), Times.Never);

            subject.Dispose();

            _mockReadWriteBinding.Verify(b => b.Dispose(), Times.Once);
        }
        public void GetReadChannelSource_should_throw_if_disposed(
            [Values(false, true)]
            bool async)
        {
            var subject = new ReadWriteBindingHandle(_mockReadWriteBinding.Object);
            subject.Dispose();

            Action act;
            if (async)
            {
                act = () => subject.GetReadChannelSourceAsync(CancellationToken.None).GetAwaiter().GetResult();
            }
            else
            {
                act = () => subject.GetReadChannelSource(CancellationToken.None);
            }

            act.ShouldThrow<ObjectDisposedException>();
        }
        public void GetWriteChannelSource_should_throw_if_disposed(
            [Values(false, true)]
            bool async)
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            subject.Dispose();

            Action act;

            if (async)
            {
                act = () => subject.GetWriteChannelSourceAsync(CancellationToken.None).GetAwaiter().GetResult();
            }
            else
            {
                act = () => subject.GetWriteChannelSource(CancellationToken.None);
            }

            act.ShouldThrow <ObjectDisposedException>();
        }
        public void Disposing_of_last_handle_should_dispose_of_connectioSource()
        {
            var subject = new ReadWriteBindingHandle(_mockReadWriteBinding.Object);

            var forked = subject.Fork();

            subject.Dispose();
            forked.Dispose();

            _mockReadWriteBinding.Verify(b => b.Dispose(), Times.Once);
        }
        public void Disposing_of_fork_before_disposing_of_subject_hould_not_dispose_of_channelSource()
        {
            var subject = new ReadWriteBindingHandle(_mockReadWriteBinding.Object);

            var forked = subject.Fork();

            forked.Dispose();

            _mockReadWriteBinding.Verify(b => b.Dispose(), Times.Never);

            subject.Dispose();

            _mockReadWriteBinding.Verify(b => b.Dispose(), Times.Once);
        }
        public void Fork_should_throw_if_disposed()
        {
            var subject = new ReadWriteBindingHandle(_mockReadWriteBinding.Object);
            subject.Dispose();

            Action act = () => subject.Fork();

            act.ShouldThrow<ObjectDisposedException>();
        }
        public void Disposing_of_handle_after_fork_should_not_dispose_of_connectionSource()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            var forked = subject.Fork();

            subject.Dispose();

            _readWriteBinding.DidNotReceive().Dispose();
        }
        public void Disposing_of_last_handle_should_dispose_of_connectioSource()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            var forked = subject.Fork();

            subject.Dispose();
            forked.Dispose();

            _readWriteBinding.Received().Dispose();
        }
        public void Disposing_of_fork_before_disposing_of_subject_hould_not_dispose_of_channelSource()
        {
            var subject = new ReadWriteBindingHandle(_readWriteBinding);

            var forked = subject.Fork();

            forked.Dispose();

            _readWriteBinding.DidNotReceive().Dispose();

            subject.Dispose();

            _readWriteBinding.Received().Dispose();
        }