Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rf5664da05a4c337985a9c55b62e825fce82844e3 -rb3a98c795a51363606d0b9271d424b248e5afe52 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision f5664da05a4c337985a9c55b62e825fce82844e3) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision b3a98c795a51363606d0b9271d424b248e5afe52) @@ -579,14 +579,72 @@ } [Test] - public void GivenAssessmentSectionWithValidInput_ThenValidationItemEnabled() + public void GivenFailureMechanismContributionZero_ThenValidationItemDisabled() { // Given string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, Path.Combine("HydraulicBoundaryDatabaseImporter", "complete.sqlite")); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism { + Contribution = 0 + }; + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = validHydroDatabasePath + }; + + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation + { + Name = "A" + }; + var context = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation, + failureMechanism, + assessmentSection); + + using (var treeViewControl = new TreeViewControl()) + { + var appFeatureCommandHandler = mocks.Stub(); + var importHandler = mocks.Stub(); + var exportHandler = mocks.Stub(); + var viewCommands = mocks.Stub(); + var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler, + importHandler, + exportHandler, + viewCommands, + context, + treeViewControl); + + var gui = mocks.Stub(); + gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) + { + // Then + TestHelper.AssertContextMenuStripContainsItem(contextMenu, + validateMenuItemIndex, + "&Valideren", + "De bijdrage van dit toetsspoor is nul.", + RingtoetsCommonFormsResources.ValidateIcon, + false); + } + } + } + + [Test] + public void GivenValidInput_ThenValidationItemEnabled() + { + // Given + string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, + Path.Combine("HydraulicBoundaryDatabaseImporter", "complete.sqlite")); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism + { Contribution = 5 }; var assessmentSection = mocks.Stub(); @@ -827,14 +885,72 @@ } [Test] - public void GivenAssessmentSectionWithValidInput_ThenCalculationItemEnabled() + public void GivenFailureMechanismContributionZero_ThenCalculationItemDisabled() { // Given string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, Path.Combine("HydraulicBoundaryDatabaseImporter", "complete.sqlite")); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism { + Contribution = 0 + }; + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = validHydroDatabasePath + }; + + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation + { + Name = "A" + }; + var context = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation, + failureMechanism, + assessmentSection); + + using (var treeViewControl = new TreeViewControl()) + { + var appFeatureCommandHandler = mocks.Stub(); + var importHandler = mocks.Stub(); + var exportHandler = mocks.Stub(); + var viewCommands = mocks.Stub(); + var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler, + importHandler, + exportHandler, + viewCommands, + context, + treeViewControl); + + var gui = mocks.Stub(); + gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) + { + // Then + TestHelper.AssertContextMenuStripContainsItem(contextMenu, + calculateMenuItemIndex, + "Be&rekenen", + "De bijdrage van dit toetsspoor is nul.", + RingtoetsCommonFormsResources.CalculateIcon, + false); + } + } + } + + [Test] + public void GivenValidInput_ThenCalculationItemEnabled() + { + // Given + string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, + Path.Combine("HydraulicBoundaryDatabaseImporter", "complete.sqlite")); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism + { Contribution = 5 }; var assessmentSection = mocks.Stub();