public void Get_RetryPolicy_Exponential() { // Arrange // Act IRetryPolicy policy = Settings.GetRetryPolicy("Exponential", TimeSpan.FromSeconds(3), 3); // Assert Assert.AreEqual(policy.GetType(), typeof(ExponentialRetry)); }
public void Get_RetryPolicy_NoRetry() { // Arrange // Act IRetryPolicy policy = Settings.GetRetryPolicy("NoRetry", TimeSpan.Zero, 0); // Assert Assert.AreEqual(policy.GetType(), typeof(NoRetry)); }
public void Get_RetryPolicy_Linear() { // Arrange // Act IRetryPolicy policy = Settings.GetRetryPolicy("Linear", TimeSpan.FromSeconds(30), 3); // Assert Assert.AreEqual(policy.GetType(), typeof(LinearRetry)); }
private static PolicyInfo GetRetryPolicyInfo(IRetryPolicy policy) { var retryPolicyType = policy.GetType(); if (retryPolicyType == typeof(RetryPolicyExtensions.WrappedExtendedRetryPolicy)) { var typedPolicy = (RetryPolicyExtensions.WrappedExtendedRetryPolicy)policy; return(RetryPolicyInfoProvider.GetRetryPolicyInfo(typedPolicy.Policy)); } RetryPolicyInfoProvider.RetryPolicyOptionsProviders.TryGetValue(retryPolicyType, out var retryPolicyOptionsProvider); return(new PolicyInfo { Namespace = retryPolicyType.Namespace, Type = retryPolicyType.Name, Options = retryPolicyOptionsProvider?.Invoke(policy) }); }