示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }