public void ActionNeverSucceeds()
        {
            var monitor = new ActionMonitor(-1);
            var retryable = CreateRetryable(monitor.Action);

            retryable.TryIt();
        }
        public void ActionNeverSucceeds()
        {
            var monitor   = new ActionMonitor(-1);
            var retryable = CreateRetryable(monitor.Action);

            retryable.TryIt();
        }
Example #3
0
        public void ActionNeverSucceeds()
        {
            var monitor   = new ActionMonitor(-1);
            var retryable = CreateRetryable(monitor.Action);

            Assert.Throws <Exception>(() => retryable.TryIt());
        }
        public void ActionFailsTwice()
        {
            var monitor   = new ActionMonitor(2);
            var retryable = CreateRetryable(monitor.Action);

            retryable.TryIt();

            Assert.AreEqual(3, monitor.TimesCalled);
        }
        public void ActionSucceedsFirstTime()
        {
            var monitor   = new ActionMonitor();
            var retryable = CreateRetryable(monitor.Action);

            retryable.TryIt();

            Assert.AreEqual(1, monitor.TimesCalled);
        }
        public void ActionFailsTwice()
        {
            var monitor = new ActionMonitor(2);
            var retryable = CreateRetryable(monitor.Action);

            retryable.TryIt();

            Assert.AreEqual(3, monitor.TimesCalled);
        }
        public void ActionSucceedsFirstTime()
        {
            var monitor = new ActionMonitor();
            var retryable = CreateRetryable(monitor.Action);

            retryable.TryIt();

            Assert.AreEqual(1, monitor.TimesCalled);
        }
        public void DelaysIncreaseWithEachRetry()
        {
            var monitor   = new ActionMonitor(3);
            var retryable = CreateRetryable(monitor.Action, 10);

            retryable.TryIt();

            var firstRetry  = _sleepMonitor.SleepPeriod[0];
            var secondRetry = _sleepMonitor.SleepPeriod[1];
            var thirdRetry  = _sleepMonitor.SleepPeriod[2];

            Assert.AreEqual(5, firstRetry);
            Assert.AreEqual(50, secondRetry);
            Assert.AreEqual(500, thirdRetry);
        }
        public void DelaysIncreaseWithEachRetry()
        {
            var monitor = new ActionMonitor(3);
            var retryable = CreateRetryable(monitor.Action, 10);

            retryable.TryIt();

            var firstRetry = _sleepMonitor.SleepPeriod[0];
            var secondRetry = _sleepMonitor.SleepPeriod[1];
            var thirdRetry = _sleepMonitor.SleepPeriod[2];

            Assert.AreEqual(5, firstRetry);
            Assert.AreEqual(50, secondRetry);
            Assert.AreEqual(500, thirdRetry);
        }