Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rc1a4fcf8b72a58508097275bc9138ffbd32bbab3 -rd8c8e5c5f71881a31ee368dd2fd976e4156f86ad --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs) (revision c1a4fcf8b72a58508097275bc9138ffbd32bbab3) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs) (revision d8c8e5c5f71881a31ee368dd2fd976e4156f86ad) @@ -345,7 +345,7 @@ } [Test] - public void ContextMenuStrip_HydraulicBoundaryDatabaseSet_ContextMenuItemPerformCalculationAndValidationEnabled() + public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemPerformCalculationAndValidationDisabledAndTooltipSet() { // Setup var guiMock = mocks.StrictMock(); @@ -356,6 +356,57 @@ Version = "1.0" }; + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("test", new[] + { + new Point2D(0, 0) + })); + + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + + var calculation = new StructuresCalculation(); + var nodeData = new StabilityPointStructuresCalculationContext(calculation, failureMechanism, assessmentSection); + + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + + mocks.ReplayAll(); + + plugin.Gui = guiMock; + + // Call + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateIndex, + "Be&rekenen", + "De bijdrage van dit toetsspoor is nul.", + RingtoetsCommonFormsResources.CalculateIcon, + false); + + TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateIndex, + "&Valideren", + "De bijdrage van dit toetsspoor is nul.", + RingtoetsCommonFormsResources.ValidateIcon, + false); + } + } + } + + [Test] + public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemPerformCalculationAndValidationEnabled() + { + // Setup + var guiMock = mocks.StrictMock(); + string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = validFilePath, + Version = "1.0" + }; + var failureMechanism = new TestStabilityPointStructuresFailureMechanism(); failureMechanism.AddSection(new FailureMechanismSection("test", new[] { Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r37453954b2d36699ea16375cdfbf89785a094ab9 -rd8c8e5c5f71881a31ee368dd2fd976e4156f86ad --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 37453954b2d36699ea16375cdfbf89785a094ab9) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision d8c8e5c5f71881a31ee368dd2fd976e4156f86ad) @@ -402,7 +402,7 @@ } [Test] - public void ContextMenuStrip_HydraulicDatabaseSet_ContextMenuItemCalculateAndValidateAllEnabled() + public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemCalculateAndValidateAllDisabledAndTooltipSet() { // Setup var group = new CalculationGroup @@ -421,6 +421,64 @@ Version = "1.0" }; + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); + + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + + var nodeData = new StabilityPointStructuresCalculationGroupContext(group, + failureMechanism, + assessmentSection); + + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + + mocks.ReplayAll(); + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, + "Alles be&rekenen", + "De bijdrage van dit toetsspoor is nul.", + RingtoetsCommonFormsResources.CalculateAllIcon, + false); + + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, + "Alles &valideren", + "De bijdrage van dit toetsspoor is nul.", + RingtoetsCommonFormsResources.ValidateAllIcon, + false); + } + } + } + + [Test] + public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAndValidateAllEnabled() + { + // Setup + var group = new CalculationGroup + { + Children = + { + new StructuresCalculation() + } + }; + + string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); + + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = validFilePath, + Version = "1.0" + }; + var failureMechanism = new TestStabilityPointStructuresFailureMechanism(); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rc1a4fcf8b72a58508097275bc9138ffbd32bbab3 -rd8c8e5c5f71881a31ee368dd2fd976e4156f86ad --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision c1a4fcf8b72a58508097275bc9138ffbd32bbab3) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../StabilityPointStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision d8c8e5c5f71881a31ee368dd2fd976e4156f86ad) @@ -535,10 +535,60 @@ } [Test] - public void ContextMenuStrip_HydraulicDatabaseSet_ContextMenuItemCalculateAndValidateAllEnabled() + public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemCalculateAndValidateAllDisabledAndTooltipSet() { // Setup var guiMock = mocksRepository.StrictMock(); + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation()); + + string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); + + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = validFilePath, + Version = "1.0" + }; + + var assessmentSection = mocksRepository.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + + var nodeData = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection); + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + + using (var plugin = new StabilityPointStructuresPlugin()) + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + mocksRepository.ReplayAll(); + + var info = GetInfo(plugin); + plugin.Gui = guiMock; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex, + "Alles be&rekenen", + "De bijdrage van dit toetsspoor is nul.", + RingtoetsCommonFormsResources.CalculateAllIcon, + false); + + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex, + "Alles &valideren", + "De bijdrage van dit toetsspoor is nul.", + RingtoetsCommonFormsResources.ValidateAllIcon, + false); + } + } + } + + [Test] + public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAndValidateAllEnabled() + { + // Setup + var guiMock = mocksRepository.StrictMock(); var failureMechanism = new TestStabilityPointStructuresFailureMechanism(); failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation());