public async Task RetryTask_does_not_retry_non_transient_exceptions() { var task = new RetryTask(() => FailingTask(4, new ArgumentNullException()), 3, noWaitProvider); await task.RunAsync().ShouldThrowAsync <ArgumentNullException>(); _callbackCounter.ShouldBe(1); }
public async Task RetryTask_works_with_exception() { var task = new RetryTask(() => FailingTask(1, new TimeoutException()), 3, noWaitProvider); await task.RunAsync(); _callbackCounter.ShouldBe(2); }
public async Task RetryTask_fails_after_four_exceptions() { var task = new RetryTask(() => FailingTask(4, new TimeoutException()), 3, noWaitProvider); await task.RunAsync().ShouldThrowAsync <TimeoutException>(); _callbackCounter.ShouldBe(4); }
public async Task RetryTask_works_with_no_exceptions() { var task = new RetryTask(() => FailingTask(0, new TimeoutException())); await task.RunAsync(); _callbackCounter.ShouldBe(1); }