public void Cancel()
        {
            var executionCount = 0;
            Action action = () => executionCount++;
            var timer = new TimerAction(action, 1, 2);
            timer.ExecuteOnFiberThread();
            Assert.AreEqual(1, executionCount);
            timer.Dispose();
            timer.ExecuteOnFiberThread();

            Assert.AreEqual(1, executionCount);
        }
        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);
        }