public void RetryParams_DelayOutOfBounds() { RetryParams retryParams = new RetryParams(TimeSpan.FromSeconds(11), true); // RetryParams should enforce the upper bound on delay time Assert.Equal(TimeSpan.FromSeconds(10), retryParams.RetryAfter); }
public RetryParams ExceptionHandler(Exception ex, int currentRetryCount) { ExceptionReceived = ex; LatestRetryCount = currentRetryCount; return(RetryParams.DefaultBackOff(currentRetryCount)); }
public void RetryParams_DefaultBackOffShouldRetryOnFirstRetry() { RetryParams retryParams = RetryParams.DefaultBackOff(0); // If this is the first time we retry, it should retry by default Assert.True(retryParams.ShouldRetry); Assert.Equal(TimeSpan.FromMilliseconds(50), retryParams.RetryAfter); }
public void RetryParams_DefaultBackOffShouldNotRetryAfter5Retries() { RetryParams retryParams = RetryParams.DefaultBackOff(10); Assert.False(retryParams.ShouldRetry); }
public void RetryParams_StopRetryingValidation() { RetryParams retryParams = RetryParams.StopRetrying; Assert.False(retryParams.ShouldRetry); }
public async Task RetryParams_StopRetryingValidation() { RetryParams retryParams = RetryParams.StopRetrying; Assert.IsFalse(retryParams.ShouldRetry); }