public void TestExecuteSimpleCommand()
 {
     TestIncrementCommand command = new TestIncrementCommand();
     command.Counter = counter;
     commandStack.ExecuteCommand(command);
     Assert.AreEqual(1, counter.CounterMember, "CommandStack does not execute commands.");
 }
Ejemplo n.º 2
0
        public void TestExecuteSimpleCommand()
        {
            TestIncrementCommand command = new TestIncrementCommand();

            command.Counter = counter;
            commandStack.ExecuteCommand(command);
            Assert.AreEqual(1, counter.CounterMember, "CommandStack does not execute commands.");
        }
        public void TestUndoSimpleCommand()
        {
            TestIncrementCommand command = new TestIncrementCommand();
            command.Counter = counter;

            commandStack.ExecuteCommand(command);
            commandStack.UndoLastCommand();
            Assert.AreEqual(0, counter.CounterMember, "CommandStack does not undo commands.");
        }
Ejemplo n.º 4
0
        public void TestUndoSimpleCommand()
        {
            TestIncrementCommand command = new TestIncrementCommand();

            command.Counter = counter;

            commandStack.ExecuteCommand(command);
            commandStack.UndoLastCommand();
            Assert.AreEqual(0, counter.CounterMember, "CommandStack does not undo commands.");
        }
        public void TestSimpleRedo()
        {
            TestIncrementCommand command = new TestIncrementCommand();
            command.Counter = counter;

            commandStack.ExecuteCommand(command);   // counter = 1.
            commandStack.UndoLastCommand();         // counter = 0.
            commandStack.RedoLastUndoneCommand();   // counter = 1.

            Assert.AreEqual(1, counter.CounterMember, "CommandStack does not redo commands.");
        }
Ejemplo n.º 6
0
        public void TestSimpleRedo()
        {
            TestIncrementCommand command = new TestIncrementCommand();

            command.Counter = counter;

            commandStack.ExecuteCommand(command);   // counter = 1.
            commandStack.UndoLastCommand();         // counter = 0.
            commandStack.RedoLastUndoneCommand();   // counter = 1.

            Assert.AreEqual(1, counter.CounterMember, "CommandStack does not redo commands.");
        }
        public void TestExecuteCommandClearsRedoStack()
        {
            TestIncrementCommand command = new TestIncrementCommand();
            TestDecrementCommand command2 = new TestDecrementCommand();
            command.Counter = counter;
            command2.Counter = counter;

            commandStack.ExecuteCommand(command);   // counter = 1.
            commandStack.UndoLastCommand();         // counter = 0.
            commandStack.ExecuteCommand(command2);  // counter = -1.

            // Should be a no op, because we have executed since last undoing.
            commandStack.RedoLastUndoneCommand();   // counter = -1.

            Assert.AreEqual(-1, counter.CounterMember, "CommandStack does not clear undo stack after executing a command.");
        }
Ejemplo n.º 8
0
        public void TestExecuteCommandClearsRedoStack()
        {
            TestIncrementCommand command  = new TestIncrementCommand();
            TestDecrementCommand command2 = new TestDecrementCommand();

            command.Counter  = counter;
            command2.Counter = counter;

            commandStack.ExecuteCommand(command);   // counter = 1.
            commandStack.UndoLastCommand();         // counter = 0.
            commandStack.ExecuteCommand(command2);  // counter = -1.

            // Should be a no op, because we have executed since last undoing.
            commandStack.RedoLastUndoneCommand();   // counter = -1.

            Assert.AreEqual(-1, counter.CounterMember, "CommandStack does not clear undo stack after executing a command.");
        }