예제 #1
0
        public void ShouldSuspend_WhenFirstAttemptEqualOrGreaterThanConnectionStateTtl_ShouldReturnTrue()
        {
            var now   = new Now();
            var state = new RealtimeState(null, now.ValueFn);

            state.AttemptsInfo.Attempts.Add(new ConnectionAttempt(now.Value));

            // Move now to default ConnectionStateTtl - 1 second
            now.Reset(DateTimeOffset.UtcNow.Add(Defaults.ConnectionStateTtl));
            state.ShouldSuspend(now.ValueFn).Should().BeTrue("When time is equal");        // =
            now.Reset(DateTimeOffset.UtcNow.Add(Defaults.ConnectionStateTtl).AddSeconds(60));
            state.ShouldSuspend(now.ValueFn).Should().BeTrue("When time is greater than"); // >
        }
예제 #2
0
 public void ShouldSuspend_WhenConnectionHasNotBeenAttempted_ShouldReturnFalse()
 {
     _state.ShouldSuspend().Should().BeFalse();
 }