public void When_state_exists_after_three_tries_It_tries_three_times() { options.RetryInterval = TimeSpan.FromMilliseconds(10); var toTry = new CountTriesAction(options); var until = new ThrowsThenSubsequentlySucceedsPredicateQuery(true, true, 2, TimeSpan.FromMilliseconds(1000), options.RetryInterval); retryUntilTimeoutRobustWrapper.TryUntil(toTry, until, TimeSpan.FromMilliseconds(100), options.RetryInterval); Assert.That(toTry.Tries, Is.EqualTo(3)); }
public void When_state_never_exists_It_fails_after_timeout_waiting_before_retry() { var toTry = new CountTriesAction(options); var until = new ThrowsThenSubsequentlySucceedsPredicateQuery(true, true, 2, new Options { Timeout = TimeSpan.FromMilliseconds(250), RetryInterval = TimeSpan.FromMilliseconds(200) }); var timeout1 = TimeSpan.FromMilliseconds(200); Assert.Throws <TestException>(() => _retryUntilTimeoutTimingStrategy.TryUntil(toTry, until, new Options { Timeout = timeout1 })); }
public void When_state_exists_after_three_tries_It_tries_three_times() { options.RetryInterval = TimeSpan.FromMilliseconds(1000); var toTry = new CountTriesAction(options); var until = new ThrowsThenSubsequentlySucceedsPredicateQuery(true, true, 2, new Options { Timeout = TimeSpan.FromMilliseconds(1000), RetryInterval = options.RetryInterval }); _retryUntilTimeoutTimingStrategy.TryUntil(toTry, until, new Options { Timeout = TimeSpan.FromMilliseconds(200) }); Assert.That(toTry.Tries, Is.EqualTo(3)); }