コード例 #1
0
        public void TestExecute_ShouldExecuteAfterCommandAction()
        {
            bool executed = false;

            ICommand command = new DelegateCommand(delegate { });
            command = new AfterCommandDecorator(command, () => executed = true);
            command.Execute(null);

            Assert.IsTrue(executed);
        }
コード例 #2
0
        public void TestExecute_ShouldExecuteActionAfterActualCommandExecution()
        {
            var record = new List<string>();

            ICommand command = new DelegateCommand(() => record.Add("a"));
            command = new AfterCommandDecorator(command, () => record.Add("b"));
            command.Execute(null);

            Assert.AreEqual("a", record[0]);
            Assert.AreEqual("b", record[1]);
        }