public void ExponentialShouldRetryUntilSuccess() { var fakeAction = new FakeAction(5); ExponentialRetry.ExecuteWithRetry( fakeAction.Run, s => s == "success", 10, NoWaitTimer).Wait(); fakeAction.Count.Should().Be(5); }
public void ExponentialShouldNotRetryAfterFirstSucceess() { var fakeAction = new FakeAction(0); ExponentialRetry.ExecuteWithRetry( fakeAction.Run, s => s == "success", 10, NoWaitTimer).Wait(); fakeAction.Count.Should().Be(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"); }