Reset() public method

Resets the wait time back to the start.
public Reset ( ) : void
return void
Exemplo n.º 1
0
        public void Create_Default_1000_2000_Reset_1000_Wait()
        {
            var times = new List<TimeSpan> { TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(2000), TimeSpan.FromMilliseconds(3000) };
            var test = new QueueWait(times, GetCancel());
            var watch = new Stopwatch();
            watch.Start();
            test.Wait();
            watch.Stop();

            Assert.InRange(watch.ElapsedMilliseconds, 950, 2000);

            watch.Restart();
            test.Wait();
            watch.Stop();

            Assert.InRange(watch.ElapsedMilliseconds, 1950, 2900);

            test.Reset();

            watch.Restart();
            test.Wait();
            watch.Stop();

            Assert.InRange(watch.ElapsedMilliseconds, 950, 2900);
        }