示例#1
0
        public void OnceAction_IsRemoved_AfterRunningOnce()
        {
            OnceAction   once   = SelectThe <OnceAction>();
            RepeatAction repeat = SelectThe <RepeatAction>();

            raiser.Raise(null, new EventArgs());

            Assert.That(scheduler.Actions.Contains(once), Is.False);
        }
示例#2
0
        public void CanRunOnce()
        {
            OnceAction   once   = SelectThe <OnceAction>();
            RepeatAction repeat = SelectThe <RepeatAction>();

            raiser.Raise(null, new EventArgs());

            Assert.That(once.executions, Is.EqualTo(1));
            Assert.That(repeat.executions, Is.EqualTo(1));
        }
示例#3
0
        public void WillCatchErrors_AndContinueExecution_OfOtherActions()
        {
            var ex = new NullReferenceException("Bad bad");

            scheduler.Actions.Insert(0, new ThrowingAction {
                ExceptionToThrow = ex
            });
            OnceAction   once   = SelectThe <OnceAction>();
            RepeatAction repeat = SelectThe <RepeatAction>();

            mocks.BackToRecord(errorHandler);
            //errorHandler.Notify(ex);  // wayne: custom error handler called instead of the error
            mocks.ReplayAll();

            raiser.Raise(null, new EventArgs());

            Assert.That(once.executions, Is.EqualTo(1));
            Assert.That(repeat.executions, Is.EqualTo(1));
        }