コード例 #1
0
        public void WhenClearActions_ShouldExecuteNothing()
        {
            var testee       = new ApplicationDispatcher();
            var actionTester = new ActionTester();

            testee.AddDelayedAction(5, actionTester.TestAction);
            testee.AddActionAfterPolls(1, actionTester.TestAction);

            testee.CancellAll();
            Thread.Sleep(25);
            testee.ExecuteInvokes();

            actionTester.WasCalled.Should().BeFalse();
        }
コード例 #2
0
        public void WhenAddMixedActions_AfterPoll_ShouldExecuteAll()
        {
            var testee = new ApplicationDispatcher();

            var action1 = new ActionTester();
            var action2 = new ActionTester();

            testee.AddDelayedAction(-1, action1.TestAction);
            testee.AddActionAfterPolls(1, action2.TestAction);

            testee.ExecuteInvokes();

            action1.WasCalled.Should().BeTrue();
            action2.WasCalled.Should().BeTrue();
        }