Example #1
0
        public void RetryJitterGeneratedDelayLargerOrEqualToDefaultDelay()
        {
            int      expectedMinimumDelay = 2;
            var      DefaultDelay         = TimeSpan.FromSeconds(expectedMinimumDelay);
            TimeSpan GeneratedDelay       = RetryJitter.GenerateDelayWithJitterForRetry(DefaultDelay);

            Assert.IsNotNull(GeneratedDelay);
            Assert.IsTrue(GeneratedDelay.Seconds >= DefaultDelay.Seconds);
        }
Example #2
0
        public void RetryJitterGeneratedDelayNoLargerThanFiveSeconds()
        {
            //current maximum jitter delay is 5 seconds, may change in the future
            int      expectedMinimumDelay = 0;
            var      DefaultDelay         = TimeSpan.FromSeconds(expectedMinimumDelay);
            TimeSpan GeneratedDelay       = RetryJitter.GenerateDelayWithJitterForRetry(DefaultDelay);

            Assert.IsNotNull(GeneratedDelay);
            Assert.IsTrue(GeneratedDelay.Seconds <= 5);
        }