public async Task ShouldHandleInboundDisconnectedMessageAndShouldQueueSetDisconnectedStateCommand() { // Act bool result = await _state.OnMessageReceived(new ProtocolMessage(ProtocolMessage.MessageAction.Disconnected), null); // Assert result.Should().BeTrue(); _context.ShouldQueueCommand <SetDisconnectedStateCommand>(); }
public async Task WithConnectedTransportAndInboundConnectedMessage_ShouldGoToConnected() { // Arrange _context.Transport = GetConnectedTransport(); // Act await _state.OnMessageReceived(new ProtocolMessage(ProtocolMessage.MessageAction.Connected), null); // Assert _context.ShouldQueueCommand <SetConnectedStateCommand>(); }
public void WhenCloseCalled_ShouldTransitionToClosedAndTimerAborted() { // Arrange var state = GetState(ErrorInfo.ReasonClosed); // Act state.Close(); // Assert _context.ShouldQueueCommand <SetClosedStateCommand>(); _timer.Aborted.Should().BeTrue(); }
public async Task ShouldRetryConnection() { _context.Transport = new FakeTransport(TransportState.Initialized); // Act _state.StartTimer(); _timer.StartedWithAction.Should().BeTrue(); _timer.OnTimeOut(); // Assert _context.ShouldQueueCommand <SetConnectingStateCommand>(); }