public void SleepCannotExceedTimeRemaining()
            {
                SystemTime.ClearOverride();

                var backoff = new ExponentialBackoff(TimeSpan.FromMilliseconds(5), TimeSpan.FromSeconds(1));

                backoff.WaitUntilRetry();

                Assert.InRange(backoff.WaitUntilRetry(), TimeSpan.FromMilliseconds(3), TimeSpan.FromMilliseconds(5));
            }
            public void SubsequentWaitsShouldSleep()
            {
                SystemTime.ClearOverride();

                var backoff = new ExponentialBackoff(TimeSpan.FromMilliseconds(100));

                backoff.WaitUntilRetry();

                Assert.NotEqual(TimeSpan.Zero, backoff.WaitUntilRetry());
            }
            public void SubsequentWaitsShouldSleep()
            {
                SystemTime.ClearOverride();

                var backoff = new ExponentialBackoff(TimeSpan.FromMilliseconds(100));

                backoff.WaitUntilRetry();

                Assert.NotEqual(TimeSpan.Zero, backoff.WaitUntilRetry());
            }
            public void SleepCannotExceedMaximumWait()
            {
                SystemTime.ClearOverride();

                var backoff = new ExponentialBackoff(TimeSpan.FromMilliseconds(5), TimeSpan.FromMilliseconds(5));

                backoff.WaitUntilRetry();

                Assert.InRange(backoff.WaitUntilRetry(), TimeSpan.FromMilliseconds(3), TimeSpan.FromMilliseconds(5));
            }