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); } } } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r74b770f7c10af3de443f319688cb1a0f20a1e5c8 -rf5664da05a4c337985a9c55b62e825fce82844e3 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision 74b770f7c10af3de443f319688cb1a0f20a1e5c8) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision f5664da05a4c337985a9c55b62e825fce82844e3) @@ -527,7 +527,7 @@ } [Test] - public void ContextMenuStrip_NestedCalculationGroupWithNoCalculations_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_NestedCalculationGroupWithoutCalculations_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl()) @@ -567,7 +567,7 @@ } [Test] - public void ContextMenuStrip_AssessmentSectionWithoutHydraulicBoundaryDatabase_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_NoHydraulicBoundaryDatabase_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl()) @@ -611,7 +611,7 @@ } [Test] - public void ContextMenuStrip_AssessmentSectionWithInvalidHydraulicBoundaryDatabasePath_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl()) Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r654a45e9c3ccf7eab91c0df4cedc924eefc7b0e2 -rf5664da05a4c337985a9c55b62e825fce82844e3 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 654a45e9c3ccf7eab91c0df4cedc924eefc7b0e2) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision f5664da05a4c337985a9c55b62e825fce82844e3) @@ -799,21 +799,68 @@ } [Test] - [TestCase(true)] - [TestCase(false)] - public void AssessmentSection_WithOrWithoutValidHydraulicBoundaryDatabase_CalculationItemEnabledOrDisabled(bool validPath) + public void GivenAssessmentSectionWithInvalidHydraulicBoundaryDatabase_ThenCalculationItemDisabled() { - // Setup + // Given var failureMechanism = new StabilityStoneCoverFailureMechanism(); var assessmentSection = mocks.Stub(); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - if (validPath) + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + + var calculation = new StabilityStoneCoverWaveConditionsCalculation { - hydraulicBoundaryDatabase.FilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, - Path.Combine("HydraulicBoundaryDatabaseImporter", "complete.sqlite")); + Name = "A" + }; + var context = new StabilityStoneCoverWaveConditionsCalculationContext(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 StabilityStoneCoverFailureMechanism(); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = validHydroDatabasePath + }; + var calculation = new StabilityStoneCoverWaveConditionsCalculation { Name = "A" @@ -845,15 +892,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); } } } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rfd8059beb2ecb8220909e41e6cc51952ad359fb5 -rf5664da05a4c337985a9c55b62e825fce82844e3 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision fd8059beb2ecb8220909e41e6cc51952ad359fb5) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision f5664da05a4c337985a9c55b62e825fce82844e3) @@ -525,7 +525,7 @@ } [Test] - public void ContextMenuStrip_NestedCalculationGroupWith_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_NestedCalculationGroupWithoutCalculations_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl()) @@ -565,7 +565,7 @@ } [Test] - public void ContextMenuStrip_AssessmentSectionWithoutHydraulicBoundaryDatabase_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_NoHydraulicBoundaryDatabase_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl()) @@ -606,7 +606,7 @@ } [Test] - public void ContextMenuStrip_AssessmentSectionWithInvalidHydraulicBoundaryDatabasePath_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl()) Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r654a45e9c3ccf7eab91c0df4cedc924eefc7b0e2 -rf5664da05a4c337985a9c55b62e825fce82844e3 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 654a45e9c3ccf7eab91c0df4cedc924eefc7b0e2) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision f5664da05a4c337985a9c55b62e825fce82844e3) @@ -769,21 +769,78 @@ } [Test] - [TestCase(true)] - [TestCase(false)] - public void AssessmentSection_WithOrWithoutValidHydraulicBoundaryDatabase_CalculationItemEnabledOrDisabled(bool validPath) + public void GivenAssessmentSectionWithInvalidHydraulicBoundaryDatabase_ThenCalculationItemDisabled() { - // Setup + // Given var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("A", new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + })); var assessmentSection = mocks.Stub(); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); - if (validPath) + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation { - hydraulicBoundaryDatabase.FilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, - Path.Combine("HydraulicBoundaryDatabaseImporter", "complete.sqlite")); + Name = "A" + }; + var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(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 WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("A", new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + })); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = validHydroDatabasePath + }; + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation { Name = "A" @@ -815,15 +872,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); } } } Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rfd8059beb2ecb8220909e41e6cc51952ad359fb5 -rf5664da05a4c337985a9c55b62e825fce82844e3 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision fd8059beb2ecb8220909e41e6cc51952ad359fb5) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision f5664da05a4c337985a9c55b62e825fce82844e3) @@ -526,7 +526,7 @@ } [Test] - public void ContextMenuStrip_NestedCalculationGroupWith_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_NestedCalculationGroupWithoutCalculations_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl()) @@ -566,7 +566,7 @@ } [Test] - public void ContextMenuStrip_AssessmentSectionWithoutHydraulicBoundaryDatabase_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_NoHydraulicBoundaryDatabase_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl()) @@ -607,7 +607,7 @@ } [Test] - public void ContextMenuStrip_AssessmentSectionWithInvalidHydraulicBoundaryDatabasePath_ValidateAndCalculateAllDisabled() + public void ContextMenuStrip_HydraulicBoundaryDatabaseNotValid_CalculateAllAndValidateAllDisabled() { // Setup using (var treeViewControl = new TreeViewControl())