Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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");
        }