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

            subject.GetReadChannelSourceAsync(CancellationToken.None);

            _readBinding.Received().GetReadChannelSourceAsync(CancellationToken.None);
        }
        public void GetReadChannelSourceAsync_should_get_the_connection_source_from_the_read_binding()
        {
            var subject = new SplitReadWriteBinding(_readBinding, _writeBinding);

            subject.GetReadChannelSourceAsync(CancellationToken.None);

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

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

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

            subject.Dispose();

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

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

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

                _readBinding.Received().GetReadChannelSourceAsync(CancellationToken.None);
            }
            else
            {
                subject.GetReadChannelSource(CancellationToken.None);

                _readBinding.Received().GetReadChannelSource(CancellationToken.None);
            }
        }
        public void GetReadChannelSource_should_throw_if_disposed(
            [Values(false, true)]
            bool async)
        {
            var subject = new SplitReadWriteBinding(_readBinding, _writeBinding);
            subject.Dispose();

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

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

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

                _mockReadBinding.Verify(b => b.GetReadChannelSourceAsync(CancellationToken.None), Times.Once);
            }
            else
            {
                subject.GetReadChannelSource(CancellationToken.None);

                _mockReadBinding.Verify(b => b.GetReadChannelSource(CancellationToken.None), Times.Once);
            }
        }
        public void GetReadChannelSource_should_get_the_connection_source_from_the_read_binding(
            [Values(false, true)]
            bool async)
        {
            var subject = new SplitReadWriteBinding(_mockReadBinding.Object, _mockWriteBinding.Object);

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

                _mockReadBinding.Verify(b => b.GetReadChannelSourceAsync(CancellationToken.None), Times.Once);
            }
            else
            {
                subject.GetReadChannelSource(CancellationToken.None);

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

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

                _readBinding.Received().GetReadChannelSourceAsync(CancellationToken.None);
            }
            else
            {
                subject.GetReadChannelSource(CancellationToken.None);

                _readBinding.Received().GetReadChannelSource(CancellationToken.None);
            }
        }
Ejemplo n.º 10
0
        public void GetReadChannelSource_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.GetReadChannelSourceAsync(CancellationToken.None).GetAwaiter().GetResult();
            }
            else
            {
                act = () => subject.GetReadChannelSource(CancellationToken.None);
            }

            act.ShouldThrow <ObjectDisposedException>();
        }