private void WaitTimes_SkippingFirstFew(int skip)
        {
            TimeSpan inifiteWaitTime = TimeSpan.FromSeconds(3);
            LinearBackoffRetryStrategy    baseStrategy = new LinearBackoffRetryStrategy(3, TimeSpan.FromSeconds(1));
            InfiniteRepeaterRetryStrategy strategy     = new InfiniteRepeaterRetryStrategy(baseStrategy);

            Assert.That(strategy.GetWaitTime(1), Is.EqualTo(TimeSpan.FromSeconds(1)), "Attempt 1");
            Assert.That(strategy.GetWaitTime(skip), Is.EqualTo(inifiteWaitTime), "Attempt " + skip);
            Assert.That(strategy.GetWaitTime(8), Is.EqualTo(inifiteWaitTime), "Attempt 8");
        }
        public void WaitTimes()
        {
            TimeSpan inifiteWaitTime = TimeSpan.FromSeconds(3);

            TimeSpan[] waitTimes = new TimeSpan[] {
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(2),
                TimeSpan.FromSeconds(3),
            };
            LinearBackoffRetryStrategy    baseStrategy = new LinearBackoffRetryStrategy(3, TimeSpan.FromSeconds(1));
            InfiniteRepeaterRetryStrategy strategy     = new InfiniteRepeaterRetryStrategy(baseStrategy);

            for (int i = 0; i < waitTimes.Length; i++)
            {
                Assert.That(strategy.ShouldRetry(i + 1), Is.True, "Attempt " + (i + 1));
                Assert.That(strategy.GetWaitTime(i + 1), Is.EqualTo(waitTimes[i]), "Attempt " + (i + 1));
            }

            Assert.That(strategy.GetWaitTime(4), Is.EqualTo(inifiteWaitTime), "Attempt 4");
            Assert.That(strategy.GetWaitTime(50), Is.EqualTo(inifiteWaitTime), "Attempt 50");
            Assert.That(strategy.GetWaitTime(600), Is.EqualTo(inifiteWaitTime), "Attempt 600");
            Assert.That(strategy.GetWaitTime(7000), Is.EqualTo(inifiteWaitTime), "Attempt 7000");
            Assert.That(strategy.GetWaitTime(9999999), Is.EqualTo(inifiteWaitTime), "Attempt 9999999");
            Assert.That(strategy.GetWaitTime(int.MaxValue), Is.EqualTo(inifiteWaitTime), "Attempt MaxValue");
        }
        public void WaitTimes()
        {
            TimeSpan inifiteWaitTime = TimeSpan.FromSeconds(3);
            TimeSpan[] waitTimes = new TimeSpan[] {
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(2),
                TimeSpan.FromSeconds(3),
            };
            LinearBackoffRetryStrategy baseStrategy = new LinearBackoffRetryStrategy(3, TimeSpan.FromSeconds(1));
            InfiniteRepeaterRetryStrategy strategy = new InfiniteRepeaterRetryStrategy(baseStrategy);

            for (int i = 0; i < waitTimes.Length; i++)
            {
                Assert.That(strategy.ShouldRetry(i + 1), Is.True, "Attempt " + (i + 1));
                Assert.That(strategy.GetWaitTime(i + 1), Is.EqualTo(waitTimes[i]), "Attempt " + (i + 1));
            }

            Assert.That(strategy.GetWaitTime(4), Is.EqualTo(inifiteWaitTime), "Attempt 4");
            Assert.That(strategy.GetWaitTime(50), Is.EqualTo(inifiteWaitTime), "Attempt 50");
            Assert.That(strategy.GetWaitTime(600), Is.EqualTo(inifiteWaitTime), "Attempt 600");
            Assert.That(strategy.GetWaitTime(7000), Is.EqualTo(inifiteWaitTime), "Attempt 7000");
            Assert.That(strategy.GetWaitTime(9999999), Is.EqualTo(inifiteWaitTime), "Attempt 9999999");
            Assert.That(strategy.GetWaitTime(int.MaxValue), Is.EqualTo(inifiteWaitTime), "Attempt MaxValue");
        }