/// <summary> /// Initializes a new instance of the <see cref="NetworkSession"/> class. /// </summary> public NetworkSession() { _isActive = false; _receiveDescriptor = new ReceiveDescriptor(this); _sendDescriptor = new SendDescriptor(this); }
/// <summary> /// Initializes a new instance of the <see cref="NetworkSession"/> class. /// </summary> public NetworkSession() { this.isActive = false; this.receiveDescriptor = new ReceiveDescriptor(this); this.sendDescriptor = new SendDescriptor(this); }
public void StartReceive_Should_Throw_If_DataArrived_Has_No_Subscribers() { var descriptor = new ReceiveDescriptor(Mock.Of <IDescriptorContainer>()); descriptor .Invoking(d => d.StartReceive()) .ShouldThrow <InvalidOperationException>() .WithMessage(CommonStrings.ReceiveEventHasNoSubscribers); }
public void StartReceive_Should_Throw_If_DataArrived_Has_No_Subscribers() { var descriptor = new ReceiveDescriptor(Mock.Of<IDescriptorContainer>()); descriptor .Invoking(d => d.StartReceive()) .ShouldThrow<InvalidOperationException>() .WithMessage(CommonStrings.ReceiveEventHasNoSubscribers); }
public void DataArrived_Should_Throw_When_Delegate_Already_Bound() { var descriptor = new ReceiveDescriptor(Mock.Of<IDescriptorContainer>()); descriptor.DataArrived += (o, e) => { }; descriptor .Invoking(d => d.DataArrived += (o, e) => { }) .ShouldThrow<InvalidOperationException>() .WithMessage(CommonStrings.EventMustHaveOnlyOneSubscriber); }
public void DataArrived_Should_Throw_When_Delegate_Already_Bound() { var descriptor = new ReceiveDescriptor(Mock.Of <IDescriptorContainer>()); descriptor.DataArrived += (o, e) => { }; descriptor .Invoking(d => d.DataArrived += (o, e) => { }) .ShouldThrow <InvalidOperationException>() .WithMessage(CommonStrings.EventMustHaveOnlyOneSubscriber); }
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()); }