예제 #1
0
        public void CanRedoWhenACommandHasBeenUndone()
        {
            var commandStack = new CommandStack();

            var mockCommand = new Mock<ICommand>();

            commandStack.Execute(mockCommand.Object);
            commandStack.Undo();

            Assert.IsTrue(commandStack.CanRedo());
        }
예제 #2
0
        public void CanNotRedoWhenACommandIsUndoneThenAnotherCommandIsExecuted()
        {
            var commandStack = new CommandStack();

            var mockCommand = new Mock<ICommand>();
            var mockCommand2 = new Mock<ICommand>();

            commandStack.Execute(mockCommand.Object);
            commandStack.Undo();
            commandStack.Execute(mockCommand2.Object);

            Assert.IsFalse(commandStack.CanRedo());
        }
예제 #3
0
        public void CanNotRedoWhenNoCommandsHaveBeenExecuted()
        {
            var commandStack = new CommandStack();

            Assert.IsFalse(commandStack.CanRedo());
        }