StartReceive() public method

Starts the receive process.
/// Thrown if the event has no subscribers. ///
public StartReceive ( ) : void
return void
        public void StartReceive_Should_Check_Container_IsActive()
        {
            var container = new Mock<IDescriptorContainer>();
            container.SetupGet(c => c.IsActive).Returns(false);

            var descriptor = new ReceiveDescriptor(container.Object);
            descriptor.DataArrived += (sender, args) => { };
            descriptor.StartReceive();

            container.Verify(c => c.IsActive, Times.Once());
        }
Esempio n. 2
0
        public void StartReceive_Should_Check_Container_IsActive()
        {
            var container = new Mock <IDescriptorContainer>();

            container.SetupGet(c => c.IsActive).Returns(false);

            var descriptor = new ReceiveDescriptor(container.Object);

            descriptor.DataArrived += (sender, args) => { };
            descriptor.StartReceive();

            container.Verify(c => c.IsActive, Times.Once());
        }
Esempio n. 3
0
        /// <summary>
        /// Starts the receive process.
        /// </summary>
        /// <exception cref="InvalidOperationException">
        /// Thrown if the <see cref="NetworkSession"/> instance does not have a socket attached to it or
        /// if the instance is already active.
        /// </exception>
        public void Start()
        {
            if (_socket == null)
            {
                throw new InvalidOperationException(CommonStrings.NoSocketAttached);
            }

            if (!_isActive.FlipIf(false))
            {
                throw new InvalidOperationException(CommonStrings.SessionAlreadyActive);
            }

            _receiveDescriptor.StartReceive();
        }