Beispiel #1
0
        public void ProgressiveTimeoutInterrupter_FailSingleTest()
        {
            var target = new ProgressiveTimeoutInterrupter <long>();

            target.Fail(null, DispatcherAvailability.NotChecked);

            DateTime?timeoutEndTime = target.GetTimeoutEndUtc();

            Assert.AreEqual(null, timeoutEndTime);
        }
Beispiel #2
0
        public void ProgressiveTimeoutInterrupter_FailManyMaxTest()
        {
            var target = new ProgressiveTimeoutInterrupter <long>();

            for (int i = 0; i < 100; i++)
            {
                target.Fail(null, DispatcherAvailability.NotChecked);
            }

            DateTime?timeoutEndTime = target.GetTimeoutEndUtc();
            DateTime expected       = DateTime.UtcNow.Add(target.TimeoutMaxDuration);

            timeoutEndTime.Value.ShouldBe(expected, TimeSpan.FromSeconds(1));
        }