示例#1
0
        public void TestExecute()
        {
            var dummy = new TestDummay4 ();
            Action<int,int,int,int> exeAction = dummy.Inc;
            Action<int,int,int,int> undoAction = dummy.Dec;

            int a = 1;
            int b = 2;
            int c = 3;
            int d = 4;

            var command = new Command<int,int,int,int>(a,b,c,d,exeAction, undoAction);
            command.Execute ();
            Assert.AreEqual (dummy.Number,10);

            command.Undo ();
            Assert.AreEqual (dummy.Number, 0);
        }
示例#2
0
        public void TestExecute()
        {
            var dummy = new TestDummay4();
            Action <int, int, int, int> exeAction  = dummy.Inc;
            Action <int, int, int, int> undoAction = dummy.Dec;

            int a = 1;
            int b = 2;
            int c = 3;
            int d = 4;


            var command = new Command <int, int, int, int>(a, b, c, d, exeAction, undoAction);

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

            command.Undo();
            Assert.AreEqual(dummy.Number, 0);
        }