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()); }
public void ExecuteCommand_NullCommand_ArgumentNullException() { var commandExecutionManager = new CommandExecutionManager(); var ex = Assert.Throws <ArgumentNullException>( () => commandExecutionManager.ExecuteCommand(null)); Assert.That(ex.ParamName, Is.EqualTo(ExecuteCommandParam)); }
public void ExecuteCommand_ExecutesCommand() { var commandExecutionManager = new CommandExecutionManager(); var commandMock = new Mock <ICommand>(); commandExecutionManager.ExecuteCommand(commandMock.Object); commandMock.Verify(c => c.Execute(), Times.Once()); }
public void Undo_PerformsUndo() { var commandExecutionManager = new CommandExecutionManager(); var commandMock = new Mock <ICommand>(); commandExecutionManager.ExecuteCommand(commandMock.Object); commandExecutionManager.Undo(); commandMock.Verify(c => c.Undo(), Times.Once()); }
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)); }