public void Menu_item_should_run_command_when_clicked() { var command = MockRepository.GenerateStub <ICommand>(); var menuCommand = new MenuCommand { Command = command }; var menuItem = new CommandToolStripMenuItem(menuCommand); menuItem.PerformClick(); command.AssertWasCalled(c => c.Execute(Arg <IProgressMonitor> .Is.Anything)); }
public void Menu_item_should_run_command_with_task_manager_if_provided_when_clicked() { var command = MockRepository.GenerateStub <ICommand>(); var menuCommand = new MenuCommand { Command = command }; var taskManager = MockRepository.GenerateStub <ITaskManager>(); var menuItem = new CommandToolStripMenuItem(menuCommand, taskManager); menuItem.PerformClick(); taskManager.AssertWasCalled(tm => tm.QueueTask(command)); }