Esempio n. 1
0
        public void Redo_PerformsRedo()
        {
            var commandExecutionManager = new CommandExecutionManager();
            var commandMock             = new Mock <ICommand>();

            commandExecutionManager.ExecuteCommand(commandMock.Object);
            commandExecutionManager.Undo();

            commandExecutionManager.Redo();

            commandMock.Verify(c => c.Execute(), Times.Exactly(2));
        }
Esempio n. 2
0
        public void ExecuteCommand_ClearsUndoHistory()
        {
            var commandExecutionManager = new CommandExecutionManager();
            var commandMock             = new Mock <ICommand>();

            commandExecutionManager.ExecuteCommand(commandMock.Object);
            commandExecutionManager.Undo();

            commandExecutionManager.ExecuteCommand(commandMock.Object);

            Assert.Throws <InvalidOperationException>(() => commandExecutionManager.Redo());
        }
Esempio n. 3
0
        public void Redo_NothingToRedo_InvalidOperationException()
        {
            var commandExecutionManager = new CommandExecutionManager();

            Assert.Throws <InvalidOperationException>(() => commandExecutionManager.Redo());
        }