Ejemplo n.º 1
0
        public void TimerInvokationTest()
        {
            var works    = false;
            var executor = new TimerBasedExecutor();

            executor.Execute(() => works = true, TimeSpan.FromMilliseconds(1));

            Assert.IsFalse(works);
            Assert.That(() => works, Is.True.After(10, 1));
        }
Ejemplo n.º 2
0
        public void TimerResetTest()
        {
            var works    = false;
            var executor = new TimerBasedExecutor();
            var timerId  = executor.Execute(() => works = true, TimeSpan.FromMilliseconds(1));

            Assert.IsFalse(works);
            executor.Cancel(timerId);
            System.Threading.Thread.Sleep(10);
            Assert.IsFalse(works);
        }