[InlineData(10 * 60)] // 10 min public void SchedulerShouldBehaveExponentially(int periodInSeconds) { var period = TimeSpan.FromSeconds(periodInSeconds); var schedule = new ExponentialBackoffConnectionSchedule(period); IBackoff backoff = new LinearBackoff(period); while (backoff is not CappedBackoff) { schedule.MarkFailure(); backoff = backoff.GetNext(schedule.NextInterval); } schedule.NextInterval.ShouldBe(ExponentialBackoffConnectionSchedule.MaximumBackoffInterval); }
[InlineData(10 * 60)] // 10 min public void BehaveExponentially(int periodInSeconds) { // Arrange var period = TimeSpan.FromSeconds(periodInSeconds); var schedule = new ExponentialBackoffConnectionSchedule(period); IBackoff backoff = new LinearBackoff(period); while (!(backoff is CappedBackoff)) { // Act schedule.MarkFailure(); // Assert backoff = backoff.GetNext(schedule.NextInterval); } }