Esempio n. 1
0
        public async Task ConnectingState_SendsHandleConnectionDisconnectedCommand()
        {
            // Act
            _state.StartTimer();
            _timer.OnTimeOut();

            // Assert
            _timer.StartedWithAction.Should().BeTrue();
            _context.ShouldQueueCommand <HandleConnectingDisconnectedCommand>();
        }
Esempio n. 2
0
        public async Task AfterTimeoutExpires_ShouldForceStateToClosed()
        {
            var state = GetState(connectedTransport: true);

            state.StartTimer();

            _timer.StartedWithAction.Should().BeTrue();
            _timer.OnTimeOut();

            _context.ShouldQueueCommand <SetClosedStateCommand>();
        }
Esempio n. 3
0
        public async Task ShouldRetryConnection()
        {
            _context.Transport = new FakeTransport(TransportState.Initialized);

            // Act
            _state.StartTimer();
            _timer.StartedWithAction.Should().BeTrue();
            _timer.OnTimeOut();

            // Assert
            _context.ShouldQueueCommand <SetConnectingStateCommand>();
        }
Esempio n. 4
0
        public async Task ShouldRetyConnection()
        {
            _context.Transport = new FakeTransport(TransportState.Initialized);

            // Act
            await _state.OnAttachToContext();

            _timer.StartedWithAction.Should().BeTrue();
            _timer.OnTimeOut();

            // Assert
            _context.StateShouldBe <ConnectionConnectingState>();
        }
Esempio n. 5
0
        public async Task ConnectingState_ForceDisconnect()
        {
            // Arrange
            _context.Transport = new FakeTransport()
            {
                State = TransportState.Initialized
            };

            // Act
            await _state.OnAttachToContext();

            _timer.OnTimeOut();

            // Assert
            _timer.StartedWithAction.Should().BeTrue();
            _context.HandledConnectionFailureCalled.Should().BeTrue();
        }
Esempio n. 6
0
        public async Task AfterAnInterval_ShouldRetryConnection()
        {
            // Arrange
            var transport = new FakeTransport {
                State = TransportState.Initialized
            };

            _context.Transport = transport;
            var state = GetState(ErrorInfo.ReasonClosed);

            // Act
            state.StartTimer();
            _timer.OnTimeOut();

            // Assert
            _timer.StartedWithAction.Should().BeTrue();
            _context.ShouldQueueCommand <SetConnectingStateCommand>();
        }
        public async Task AfterAnInterval_ShouldRetryConnection()
        {
            // Arrange
            var transport = new FakeTransport()
            {
                State = TransportState.Initialized
            };

            _context.Transport = transport;
            var state = GetState(ErrorInfo.ReasonClosed);

            // Act
            await state.OnAttachToContext();

            _timer.OnTimeOut();

            // Assert
            _timer.StartedWithAction.Should().BeTrue();
            _context.StateShouldBe <ConnectionConnectingState>();
        }