Ejemplo n.º 1
0
        public void GetWriteChannelSourceAsync_should_get_the_connection_source_from_the_write_binding()
        {
            var subject = new SplitReadWriteBinding(_readBinding, _writeBinding);

            subject.GetWriteChannelSourceAsync(CancellationToken.None);

            _writeBinding.Received().GetWriteChannelSourceAsync(CancellationToken.None);
        }
        public void GetWriteChannelSourceAsync_should_throw_if_disposed()
        {
            var subject = new SplitReadWriteBinding(_readBinding, _writeBinding);
            subject.Dispose();

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

            act.ShouldThrow<ObjectDisposedException>();
        }
Ejemplo n.º 3
0
        public void GetWriteChannelSourceAsync_should_throw_if_disposed()
        {
            var subject = new SplitReadWriteBinding(_readBinding, _writeBinding);

            subject.Dispose();

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

            act.ShouldThrow <ObjectDisposedException>();
        }
Ejemplo n.º 4
0
        public void GetWriteChannelSource_should_get_the_connection_source_from_the_write_binding(
            [Values(false, true)]
            bool async)
        {
            var subject = new SplitReadWriteBinding(_mockReadBinding.Object, _mockWriteBinding.Object);

            if (async)
            {
                subject.GetWriteChannelSourceAsync(CancellationToken.None).GetAwaiter().GetResult();

                _mockWriteBinding.Verify(b => b.GetWriteChannelSourceAsync(CancellationToken.None), Times.Once);
            }
            else
            {
                subject.GetWriteChannelSource(CancellationToken.None);

                _mockWriteBinding.Verify(b => b.GetWriteChannelSource(CancellationToken.None), Times.Once);
            }
        }
        public void GetWriteChannelSource_should_get_the_connection_source_from_the_write_binding(
            [Values(false, true)]
            bool async)
        {
            var subject = new SplitReadWriteBinding(_readBinding, _writeBinding);

            if (async)
            {
                subject.GetWriteChannelSourceAsync(CancellationToken.None).GetAwaiter().GetResult();

                _writeBinding.Received().GetWriteChannelSourceAsync(CancellationToken.None);
            }
            else
            {
                subject.GetWriteChannelSource(CancellationToken.None);

                _writeBinding.Received().GetWriteChannelSource(CancellationToken.None);
            }
        }
Ejemplo n.º 6
0
        public void GetWriteChannelSource_should_throw_if_disposed(
            [Values(false, true)]
            bool async)
        {
            var subject = new SplitReadWriteBinding(_mockReadBinding.Object, _mockWriteBinding.Object);

            subject.Dispose();

            Action act;

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

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

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

            act.ShouldThrow<ObjectDisposedException>();
        }
        public void GetWriteChannelSource_should_get_the_connection_source_from_the_write_binding(
            [Values(false, true)]
            bool async)
        {
            var subject = new SplitReadWriteBinding(_readBinding, _writeBinding);

            if (async)
            {
                subject.GetWriteChannelSourceAsync(CancellationToken.None).GetAwaiter().GetResult();

                _writeBinding.Received().GetWriteChannelSourceAsync(CancellationToken.None);
            }
            else
            {
                subject.GetWriteChannelSource(CancellationToken.None);

                _writeBinding.Received().GetWriteChannelSource(CancellationToken.None);
            }
        }
        public void GetWriteChannelSource_should_get_the_connection_source_from_the_write_binding(
            [Values(false, true)]
            bool async)
        {
            var subject = new SplitReadWriteBinding(_mockReadBinding.Object, _mockWriteBinding.Object);

            if (async)
            {
                subject.GetWriteChannelSourceAsync(CancellationToken.None).GetAwaiter().GetResult();

                _mockWriteBinding.Verify(b => b.GetWriteChannelSourceAsync(CancellationToken.None), Times.Once);
            }
            else
            {
                subject.GetWriteChannelSource(CancellationToken.None);

                _mockWriteBinding.Verify(b => b.GetWriteChannelSource(CancellationToken.None), Times.Once);
            }
        }
        public void GetWriteChannelSourceAsync_should_get_the_connection_source_from_the_write_binding()
        {
            var subject = new SplitReadWriteBinding(_readBinding, _writeBinding);

            subject.GetWriteChannelSourceAsync(CancellationToken.None);

            _writeBinding.Received().GetWriteChannelSourceAsync(CancellationToken.None);
        }