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()); }
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()); }
/// <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(); }