public void CountBasedFixedDelayRetry_Last_Retry_Delay_Is_Zero() { var testRetryPolicy = new CountBasedFixedDelayRetryPolicy(1, TimeSpan.FromSeconds(1)); TimeSpan lastDelay = TimeSpan.MaxValue; while (testRetryPolicy.ShouldExecute()) { lastDelay = testRetryPolicy.GetNextDelay(); } Assert.AreEqual(TimeSpan.Zero, lastDelay); }
public void CountBasedFixedDelayRetry_Non_Last_Retry_Delay_Is_Fixed() { TimeSpan fixedDelay = TimeSpan.FromSeconds(23); var testRetryPolicy = new CountBasedFixedDelayRetryPolicy(3, fixedDelay); int attemptNumber = 1; TimeSpan nextDelay = TimeSpan.MaxValue; while (testRetryPolicy.ShouldExecute()) { nextDelay = testRetryPolicy.GetNextDelay(); if (attemptNumber < 3) { Assert.AreEqual(fixedDelay, nextDelay); } attemptNumber++; } Assert.AreEqual(TimeSpan.Zero, nextDelay); }