Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r654a45e9c3ccf7eab91c0df4cedc924eefc7b0e2 -rf5664da05a4c337985a9c55b62e825fce82844e3 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 654a45e9c3ccf7eab91c0df4cedc924eefc7b0e2) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision f5664da05a4c337985a9c55b62e825fce82844e3) @@ -775,24 +775,74 @@ } [Test] - [TestCase(true, TestName = "AssessmentSection_WithOrWithoutPath_CalculateEnabledOrDisabled(true)")] - [TestCase(false, TestName = "AssessmentSection_WithOrWithoutPath_CalculateEnabledOrDisabled(false)")] - public void AssessmentSection_WithOrWithoutValidHydraulicBoundaryDatabase_CalculationItemEnabledOrDisabled(bool validPath) + public void GivenAssessmentSectionWithInvalidHydraulicBoundaryDatabase_ThenCalculationItemDisabled() { - // Setup + // Given var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism { Contribution = 5 }; var assessmentSection = mocks.Stub(); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - if (validPath) + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation { - hydraulicBoundaryDatabase.FilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, - Path.Combine("HydraulicBoundaryDatabaseImporter", "complete.sqlite")); + 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", + "Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand '': bestandspad mag niet leeg of ongedefinieerd zijn.", + RingtoetsCommonFormsResources.CalculateIcon, + false); + } } - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + } + [Test] + public void GivenAssessmentSectionWithValidInput_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(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = validHydroDatabasePath + }; + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation { Name = "A" @@ -824,15 +874,11 @@ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) { // Then - var expectedTooltip = validPath - ? "Voer deze berekening uit." - : "Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand '': bestandspad mag niet leeg of ongedefinieerd zijn."; TestHelper.AssertContextMenuStripContainsItem(contextMenu, calculateMenuItemIndex, "Be&rekenen", - expectedTooltip, - RingtoetsCommonFormsResources.CalculateIcon, - validPath); + "Voer deze berekening uit.", + RingtoetsCommonFormsResources.CalculateIcon); } } }