public void RetryAfterWithExponentialFallbackS( [Values("Retry-After", null)] string headerName, [Values( new int[] { 1, 2, 1, 2 }, new int[] { 1, 1, 2 }, new int[] { 1, 5, 2, 2, 10, 8 }, new int[] { 1, 5, 1, 2, 10, 8, 20, 20, 20, 20, 20, 20, 20 })] int[] delayValues, [Values(1, 2, 5, null)] int?suggestedWaitInMs) { var fallbackStrategy = new ExponentialDelayStrategy(); TimeSpan[] defaultDelays = fallbackStrategy.GetType().GetField("_pollingSequence", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null) as TimeSpan[]; var strategy = new RetryAfterDelayStrategy(fallbackStrategy); TimeSpan actual = TimeSpan.Zero; TimeSpan? suggestion = suggestedWaitInMs.HasValue ? TimeSpan.FromSeconds(suggestedWaitInMs.Value) : null; int expected = 0; for (int i = 0; i < delayValues.Length; i++) { var response = new MockResponse(200); //ignore suggestion for exponential expected += GetExpected(headerName, delayValues[i], null, (int)defaultDelays[Math.Min(i, defaultDelays.Length - 1)].TotalSeconds); if (headerName is not null) { response.AddHeader(new HttpHeader(headerName, delayValues[i].ToString())); } actual += strategy.GetNextDelay(response, suggestion); } Assert.AreEqual(TimeSpan.FromSeconds(expected), actual); }