Пример #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());
        }