Example #1
0
        public void TestCtr()
        {
            var    dummy      = new TestDummay0();
            Action exeAction  = dummy.Inc;
            Action undoAction = dummy.Dec;

            Assert.Throws <ArgumentNullException> (() => Command.Create(null, null));
            Assert.Throws <ArgumentNullException> (() => Command.Create(exeAction, null));
            Assert.Throws <ArgumentNullException> (() => Command.Create(null, undoAction));
        }
Example #2
0
        public void TestCtr()
        {
            var dummy = new TestDummay0 ();
            Action exeAction = dummy.Inc;
            Action undoAction = dummy.Dec;

            Assert.Throws<ArgumentNullException> (() => Command.Create (null, null));
            Assert.Throws<ArgumentNullException> (() => Command.Create (exeAction, null));
            Assert.Throws<ArgumentNullException> (() => Command.Create (null, undoAction));
        }
Example #3
0
        public void TestExecute()
        {
            var dummy = new TestDummay0 ();
            Action exeAction = dummy.Inc;
            Action undoAction = dummy.Dec;

            var command = Command.Create (exeAction, undoAction);
            command.Execute ();
            Assert.AreEqual (dummy.Number, 1);

            command.Execute ();
            Assert.AreEqual (dummy.Number, 2);

            command.Undo ();
            Assert.AreEqual (dummy.Number, 1);

            command.Redo ();
            Assert.AreEqual (dummy.Number, 2);
        }
Example #4
0
        public void TestExecute()
        {
            var    dummy      = new TestDummay0();
            Action exeAction  = dummy.Inc;
            Action undoAction = dummy.Dec;

            var command = Command.Create(exeAction, undoAction);

            command.Execute();
            Assert.AreEqual(dummy.Number, 1);

            command.Execute();
            Assert.AreEqual(dummy.Number, 2);

            command.Undo();
            Assert.AreEqual(dummy.Number, 1);

            command.Redo();
            Assert.AreEqual(dummy.Number, 2);
        }