Exemple #1
0
        public void ExponentialShouldRetryUntilSuccess()
        {
            var fakeAction = new FakeAction(5);

            ExponentialRetry.ExecuteWithRetry(
                fakeAction.Run,
                s => s == "success",
                10,
                NoWaitTimer).Wait();
            fakeAction.Count.Should().Be(5);
        }
Exemple #2
0
        public void ExponentialShouldNotRetryAfterFirstSucceess()
        {
            var fakeAction = new FakeAction(0);

            ExponentialRetry.ExecuteWithRetry(
                fakeAction.Run,
                s => s == "success",
                10,
                NoWaitTimer).Wait();
            fakeAction.Count.Should().Be(0);
        }
Exemple #3
0
        public void ExponentialShouldThrowAfterMaximumAmountReached()
        {
            var    fakeAction = new FakeAction(10);
            Action a          = () => ExponentialRetry.ExecuteWithRetry(
                fakeAction.Run,
                s => s == "success",
                5,
                NoWaitTimer,
                "testing retry").Wait();

            a.ShouldThrow <RetryFailedException>()
            .WithMessage("Retry failed for testing retry after 5 times with result: fail");
        }