public void CreateExportItem_CanExportFrom_CausesExportToStartWhenClicked() { // Setup var commandHandler = mocks.StrictMock <IApplicationFeatureCommands>(); var importCommandHandler = mocks.StrictMock <IImportCommandHandler>(); var exportCommandHandler = mocks.StrictMock <IExportCommandHandler>(); var updateCommandHandler = mocks.StrictMock <IUpdateCommandHandler>(); var viewCommands = mocks.StrictMock <IViewCommands>(); var nodeData = new object(); exportCommandHandler.Expect(ch => ch.CanExportFrom(nodeData)).Return(true); exportCommandHandler.Expect(ch => ch.ExportFrom(nodeData)); mocks.ReplayAll(); var contextMenuFactory = new GuiContextMenuItemFactory(commandHandler, importCommandHandler, exportCommandHandler, updateCommandHandler, viewCommands, nodeData); ToolStripItem item = contextMenuFactory.CreateExportItem(); // Call item.PerformClick(); // Assert mocks.VerifyAll(); }
public void CreateExportItem_Always_ItemWithPropertiesSet(bool hasExportersForNodeData) { // Setup var commandHandler = mocks.StrictMock <IApplicationFeatureCommands>(); var importCommandHandler = mocks.StrictMock <IImportCommandHandler>(); var exportCommandHandler = mocks.StrictMock <IExportCommandHandler>(); var updateCommandHandler = mocks.StrictMock <IUpdateCommandHandler>(); var viewCommands = mocks.StrictMock <IViewCommands>(); var nodeData = new object(); exportCommandHandler.Expect(ch => ch.CanExportFrom(nodeData)).Return(hasExportersForNodeData); mocks.ReplayAll(); var contextMenuFactory = new GuiContextMenuItemFactory(commandHandler, importCommandHandler, exportCommandHandler, updateCommandHandler, viewCommands, nodeData); // Call ToolStripItem item = contextMenuFactory.CreateExportItem(); // Assert Assert.AreEqual("&Exporteren...", item.Text); Assert.AreEqual("Exporteer de gegevens naar een bestand.", item.ToolTipText); TestHelper.AssertImagesAreEqual(Resources.ExportIcon, item.Image); Assert.AreEqual(hasExportersForNodeData, item.Enabled); mocks.VerifyAll(); }