private static void AssertRetryOptionsEntry <T>( string key, T?expectedValue, CallActivityWithRetryAction actualAction) where T : struct { if (expectedValue.HasValue) { Assert.Equal(expectedValue.Value, actualAction.RetryOptions[key]); } else { Assert.False(actualAction.RetryOptions.ContainsKey(key)); } }
public void RetryOptionsContainsNonNullProperties( int firstRetryIntervalInMilliseconds, int maxNumberOfAttempts, double?backoffCoefficient, int?maxRetryIntervalInMilliseconds, int?retryTimeoutInMilliseconds) { var retryOptions = new RetryOptions( TimeSpan.FromMilliseconds(firstRetryIntervalInMilliseconds), maxNumberOfAttempts, backoffCoefficient, CreateTimeSpanOrNull(maxRetryIntervalInMilliseconds), CreateTimeSpanOrNull(retryTimeoutInMilliseconds)); var action = new CallActivityWithRetryAction("FunctionName", "input", retryOptions); Assert.Equal(firstRetryIntervalInMilliseconds, action.RetryOptions["firstRetryIntervalInMilliseconds"]); Assert.Equal(maxNumberOfAttempts, action.RetryOptions["maxNumberOfAttempts"]); AssertRetryOptionsEntry("backoffCoefficient", backoffCoefficient, action); AssertRetryOptionsEntry("maxRetryIntervalInMilliseconds", maxRetryIntervalInMilliseconds, action); AssertRetryOptionsEntry("retryTimeoutInMilliseconds", retryTimeoutInMilliseconds, action); }