Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsDesignWaterLevelCalculationsContextTreeNodeInfoTest.cs =================================================================== diff -u -recb0e5b29e11012efd3944171530d9310e07804a -r81c5a3672b67abf1568a33f3f5b1717a5d866dfe --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsDesignWaterLevelCalculationsContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelCalculationsContextTreeNodeInfoTest.cs) (revision ecb0e5b29e11012efd3944171530d9310e07804a) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsDesignWaterLevelCalculationsContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelCalculationsContextTreeNodeInfoTest.cs) (revision 81c5a3672b67abf1568a33f3f5b1717a5d866dfe) @@ -312,6 +312,71 @@ } [Test] + public void ContextMenuStrip_InvalidNorm_ContextMenuItemCalculateAllDisabledAndTooltipSet() + { + // Setup + var assessmentSection = mockRepository.Stub(); + var applicationFeatureCommandHandler = mockRepository.Stub(); + var importCommandHandler = mockRepository.Stub(); + var exportCommandHandler = mockRepository.Stub(); + var updateCommandHandler = mockRepository.Stub(); + var viewCommandsHandler = mockRepository.Stub(); + + viewCommandsHandler.Stub(vch => vch.CanOpenViewFor(null)).IgnoreArguments().Return(true); + assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase + { + FilePath = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, "HydraulicBoundaryDatabaseImporter"), "complete.sqlite"), + Version = "1.0" + }); + + using (var treeViewControl = new TreeViewControl()) + { + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + var context = new GrassCoverErosionOutwardsDesignWaterLevelCalculationsContext(new ObservableList(), + new GrassCoverErosionOutwardsFailureMechanism + { + Contribution = 5 + }, assessmentSection, + () => 1.0, + "A"); + + + var menuBuilder = new ContextMenuBuilder(applicationFeatureCommandHandler, + importCommandHandler, + exportCommandHandler, + updateCommandHandler, + viewCommandsHandler, + context, + treeViewControl); + + var gui = mockRepository.Stub(); + gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder); + + mockRepository.ReplayAll(); + + plugin.Gui = gui; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(context, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, + contextMenuRunDesignWaterLevelCalculationsIndex, + "Alles be&rekenen", + "Doelkans is te groot om een berekening uit te kunnen voeren.", + RingtoetsCommonFormsResources.CalculateAllIcon, + false); + } + } + } + + mockRepository.VerifyAll(); + } + + [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllEnabled() { // Setup Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveHeightCalculationsContextTreeNodeInfoTest.cs =================================================================== diff -u -recb0e5b29e11012efd3944171530d9310e07804a -r81c5a3672b67abf1568a33f3f5b1717a5d866dfe --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveHeightCalculationsContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveHeightCalculationsContextTreeNodeInfoTest.cs) (revision ecb0e5b29e11012efd3944171530d9310e07804a) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveHeightCalculationsContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveHeightCalculationsContextTreeNodeInfoTest.cs) (revision 81c5a3672b67abf1568a33f3f5b1717a5d866dfe) @@ -301,6 +301,70 @@ } [Test] + public void ContextMenuStrip_InvalidNorm_ContextMenuItemCalculateAllDisabledAndTooltipSet() + { + // Setup + var assessmentSection = mockRepository.Stub(); + var applicationFeatureCommandHandler = mockRepository.Stub(); + var importCommandHandler = mockRepository.Stub(); + var exportCommandHandler = mockRepository.Stub(); + var updateCommandHandler = mockRepository.Stub(); + var viewCommandsHandler = mockRepository.Stub(); + + viewCommandsHandler.Stub(vch => vch.CanOpenViewFor(null)).IgnoreArguments().Return(true); + assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase + { + FilePath = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, "HydraulicBoundaryDatabaseImporter"), "complete.sqlite"), + Version = "1.0" + }); + + using (var treeViewControl = new TreeViewControl()) + { + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + var context = new GrassCoverErosionOutwardsWaveHeightCalculationsContext(new ObservableList(), + new GrassCoverErosionOutwardsFailureMechanism + { + Contribution = 5 + }, assessmentSection, + () => 1.0, + "A"); + + var menuBuilder = new ContextMenuBuilder(applicationFeatureCommandHandler, + importCommandHandler, + exportCommandHandler, + updateCommandHandler, + viewCommandsHandler, + context, + treeViewControl); + + var gui = mockRepository.Stub(); + gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder); + + mockRepository.ReplayAll(); + + plugin.Gui = gui; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(context, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, + contextMenuRunWaveHeightCalculationsIndex, + "Alles be&rekenen", + "Doelkans is te groot om een berekening uit te kunnen voeren.", + RingtoetsCommonFormsResources.CalculateAllIcon, + false); + } + } + } + + mockRepository.VerifyAll(); + } + + [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllEnabled() { // Setup