Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r2973c5f790a5131e427bd5f73e2a620044199639 -rb6f4e414fc874653cc6ad84b80f330b28e69b823 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 2973c5f790a5131e427bd5f73e2a620044199639) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision b6f4e414fc874653cc6ad84b80f330b28e69b823) @@ -338,11 +338,6 @@ "Voeg een nieuwe berekening toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.CalculationIcon); - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRemoveAllChildrenIndexRootGroup, - RingtoetsCommonFormsResources.CalculationGroup_RemoveAllChildrenFromGroup_Remove_all, - RingtoetsCommonFormsResources.CalculationGroup_RemoveAllChildrenFromGroup_Remove_all_Tooltip, - RingtoetsCommonFormsResources.RemoveAllIcon); - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, RingtoetsCommonFormsResources.Validate_all, "Valideer alle berekeningen binnen deze berekeningsmap.", @@ -561,86 +556,6 @@ } [Test] - public void ContextMenuStrip_WithoutParentNodeWithNoChildren_RemoveAllChildrenDisabled() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var group = new CalculationGroup(); - - var pipingFailureMechanism = new PipingFailureMechanism(); - var assessmentSectionMock = mocks.StrictMock(); - var nodeData = new PipingCalculationGroupContext(group, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSectionMock); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - var gui = mocks.StrictMock(); - gui.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem removeAllItemDisabled = contextMenu.Items[customOnlyContextMenuRemoveAllChildrenIndex]; - Assert.IsFalse(removeAllItemDisabled.Enabled); - Assert.AreEqual(RingtoetsCommonFormsResources.CalculationGroup_RemoveAllChildrenFromGroup_No_Calculation_or_Group_to_remove, removeAllItemDisabled.ToolTipText); - } - } - } - - [Test] - public void ContextMenuStrip_WithoutParentNodeWithChildren_RemoveAllChildrenEnabled() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var group = new CalculationGroup - { - Children = - { - mocks.Stub() - } - }; - - var pipingFailureMechanism = new PipingFailureMechanism(); - var assessmentSectionMock = mocks.StrictMock(); - var nodeData = new PipingCalculationGroupContext(group, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSectionMock); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - var gui = mocks.StrictMock(); - gui.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); - - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - ToolStripItem removeAllItemEnabled = contextMenu.Items[customOnlyContextMenuRemoveAllChildrenIndex]; - Assert.IsTrue(removeAllItemEnabled.Enabled); - Assert.AreEqual(RingtoetsCommonFormsResources.CalculationGroup_RemoveAllChildrenFromGroup_Remove_all_Tooltip, removeAllItemEnabled.ToolTipText); - } - } - } - - [Test] public void ContextMenuStrip_ClickOnAddGroupItem_AddGroupToCalculationGroupAndNotifyObservers() { // Setup @@ -1051,58 +966,6 @@ } [Test] - public void ContextMenuStrip_ClickOnRemoveAllInGroup_RemovesAllChildren() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var calculation = mocks.Stub(); - var group = new CalculationGroup - { - Children = - { - calculation - } - }; - - var pipingFailureMechanism = new PipingFailureMechanism(); - var assessmentSectionMock = mocks.StrictMock(); - var nodeData = new PipingCalculationGroupContext(group, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSectionMock); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - var viewCommandsMock = mocks.StrictMock(); - viewCommandsMock.Expect(vc => vc.RemoveAllViewsForItem(calculation)); - - var gui = mocks.StrictMock(); - gui.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - gui.Stub(cmp => cmp.ViewCommands).Return(viewCommandsMock); - - mocks.ReplayAll(); - - plugin.Gui = gui; - - DialogBoxHandler = (name, wnd) => - { - var dialog = new MessageBoxTester(wnd); - dialog.ClickOk(); - }; - - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Call - contextMenu.Items[customOnlyContextMenuRemoveAllChildrenIndex].PerformClick(); - - // Assert - Assert.IsEmpty(group.Children); - } - } - } - - [Test] public void GivenPipingCalculationsViewGenerateScenariosButtonClicked_WhenSurfaceLineSelectedAndDialogClosed_ThenUpdateSectionResultScenarios() { // Given