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