示例#1
0
        public void CallbackFromTimerWithCancel()
        {
            var mocks    = new MockRepository();
            var action   = mocks.CreateMock <Action>();
            var timer    = new TimerAction(action, 2, Timeout.Infinite);
            var registry = mocks.CreateMock <ISchedulerRegistry>();

            registry.Remove(timer);
            registry.Enqueue(timer.ExecuteOnFiberThread);

            mocks.ReplayAll();
            timer.ExecuteOnTimerThread(registry);
        }
示例#2
0
        public void CallbackFromIntervalTimerWithCancel()
        {
            var mocks    = new MockRepository();
            var action   = mocks.CreateMock <Action>();
            var timer    = new TimerAction(action, 2, 3);
            var registry = mocks.CreateMock <ISchedulerRegistry>();

            registry.Remove(timer);

            mocks.ReplayAll();

            timer.Dispose();
            timer.ExecuteOnTimerThread(registry);
        }