示例#1
0
        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);
        }
示例#2
0
        public async Task RetryTask_works_with_exception()
        {
            var task = new RetryTask(() => FailingTask(1, new TimeoutException()), 3, noWaitProvider);
            await task.RunAsync();

            _callbackCounter.ShouldBe(2);
        }
示例#3
0
        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);
        }
示例#4
0
        public async Task RetryTask_works_with_no_exceptions()
        {
            var task = new RetryTask(() => FailingTask(0, new TimeoutException()));
            await task.RunAsync();

            _callbackCounter.ShouldBe(1);
        }