Esempio n. 1
0
        public void PropertiesCorrespondToErrorInfoConstructor()
        {
            const ConnectionState cs = ConnectionState.Closed;

            var o = new AttemptFailedState(cs, ErrorInfo.ReasonDisconnected);

            o.Error.Should().Be(ErrorInfo.ReasonDisconnected);
            o.Exception.Should().BeNull();
            o.State.Should().Be(cs);
        }
Esempio n. 2
0
        public void PropertiesCorrespondToExceptionConstructor()
        {
            const ConnectionState cs = ConnectionState.Closed;
            var e = new AblyException("Something wicked this way comes");

            var o = new AttemptFailedState(cs, e);

            o.Error.Should().BeNull();
            o.Exception.Should().Be(e);
            o.State.Should().Be(cs);
        }
Esempio n. 3
0
        public void FailedStatesAccumulatesAndPreservesOrder()
        {
            var first  = new AttemptFailedState(ConnectionState.Failed, ErrorInfo.ReasonClosed);
            var second = new AttemptFailedState(ConnectionState.Connecting, ErrorInfo.ReasonTimeout);
            var third  = new AttemptFailedState(ConnectionState.Closed, ErrorInfo.ReasonUnknown);

            var o = new ConnectionAttempt(DateTimeOffset.Now);

            o.FailedStates.Add(first);
            o.FailedStates.Add(second);
            o.FailedStates.Add(third);

            o.FailedStates.Count.Should().Be(3);
            o.FailedStates[0].Should().Be(first);
            o.FailedStates[1].Should().Be(second);
            o.FailedStates[2].Should().Be(third);
        }