Пример #1
0
        public void TestExecute()
        {
            var dummy = new TestDummay5 ();
            Action<int,int,int,int,int> exeAction = dummy.Inc;
            Action<int,int,int,int,int> undoAction = dummy.Dec;

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

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

            command.Undo ();
            Assert.AreEqual (dummy.Number, 0);
        }
Пример #2
0
        public void TestExecute()
        {
            var dummy = new TestDummay5();
            Action <int, int, int, int, int> exeAction  = dummy.Inc;
            Action <int, int, int, int, int> undoAction = dummy.Dec;

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

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

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

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