Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/CalculationsStateRootContextTreeNodeInfoTest.cs =================================================================== diff -u -r7150c8ed1bd229a4c5954b0142fb777d082898da -red5e764396e623ae40a653d7c74f7877517df733 --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/CalculationsStateRootContextTreeNodeInfoTest.cs (.../CalculationsStateRootContextTreeNodeInfoTest.cs) (revision 7150c8ed1bd229a4c5954b0142fb777d082898da) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/CalculationsStateRootContextTreeNodeInfoTest.cs (.../CalculationsStateRootContextTreeNodeInfoTest.cs) (revision ed5e764396e623ae40a653d7c74f7877517df733) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Windows.Forms; @@ -30,16 +31,20 @@ using Core.Gui.TestUtil.ContextMenu; using NUnit.Framework; using Rhino.Mocks; +using Riskeer.ClosingStructures.Data.TestUtil; using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState; using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.TestUtil; using Riskeer.Common.Plugin.TestUtil; +using Riskeer.GrassCoverErosionInwards.Data; using Riskeer.GrassCoverErosionInwards.Forms.PresentationObjects.CalculationsState; +using Riskeer.HeightStructures.Data.TestUtil; using Riskeer.HeightStructures.Forms.PresentationObjects.CalculationsState; using Riskeer.Integration.Data; using Riskeer.Integration.Forms.PresentationObjects; using Riskeer.MacroStabilityInwards.Forms.PresentationObjects.CalculationsState; using Riskeer.Piping.Forms.PresentationObjects.CalculationsState; +using Riskeer.StabilityPointStructures.Data.TestUtil; using Riskeer.StabilityPointStructures.Forms.PresentationObjects.CalculationsState; using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; using RiskeerIntegrationFormsResources = Riskeer.Integration.Forms.Properties.Resources; @@ -238,18 +243,12 @@ } [Test] - public void ContextMenuStrip_WithCalculations_AddCustomItems() + [TestCaseSource(nameof(GetAssessmentSections))] + public void ContextMenuStrip_WithCalculations_CalculateAllEnabled(AssessmentSection assessmentSection) { // Setup using (var treeView = new TreeViewControl()) { - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - assessmentSection.Piping.CalculationsGroup.Children.Add(new TestCalculationScenario()); - assessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Add(new TestCalculationScenario()); - assessmentSection.MacroStabilityInwards.CalculationsGroup.Children.Add(new TestCalculationScenario()); - assessmentSection.HeightStructures.CalculationsGroup.Children.Add(new TestCalculationScenario()); - assessmentSection.ClosingStructures.CalculationsGroup.Children.Add(new TestCalculationScenario()); - assessmentSection.StabilityPointStructures.CalculationsGroup.Children.Add(new TestCalculationScenario()); var context = new CalculationsStateRootContext(assessmentSection); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); @@ -368,6 +367,88 @@ } } + private static IEnumerable GetAssessmentSections() + { + yield return new TestCaseData(new AssessmentSection(AssessmentSectionComposition.Dike) + { + Piping = + { + CalculationsGroup = + { + Children = + { + new TestCalculationScenario() + } + } + } + }).SetName("PipingCalculation"); + yield return new TestCaseData(new AssessmentSection(AssessmentSectionComposition.Dike) + { + GrassCoverErosionInwards = + { + CalculationsGroup = + { + Children = + { + new GrassCoverErosionInwardsCalculation() + } + } + } + }).SetName("GrassCoverErosionInwardsCalculation"); + yield return new TestCaseData(new AssessmentSection(AssessmentSectionComposition.Dike) + { + MacroStabilityInwards = + { + CalculationsGroup = + { + Children = + { + new TestCalculationScenario() + } + } + } + }).SetName("MacroStabilityInwardsCalculation"); + yield return new TestCaseData(new AssessmentSection(AssessmentSectionComposition.Dike) + { + HeightStructures = + { + CalculationsGroup = + { + Children = + { + new TestHeightStructuresCalculationScenario() + } + } + } + }).SetName("HeightStructuresCalculation"); + yield return new TestCaseData(new AssessmentSection(AssessmentSectionComposition.Dike) + { + ClosingStructures = + { + CalculationsGroup = + { + Children = + { + new TestClosingStructuresCalculationScenario() + } + } + } + }).SetName("ClosingStructuresCalculation"); + yield return new TestCaseData(new AssessmentSection(AssessmentSectionComposition.Dike) + { + StabilityPointStructures = + { + CalculationsGroup = + { + Children = + { + new TestStabilityPointStructuresCalculationScenario() + } + } + } + }).SetName("StabilityPointStructuresCalculation"); + } + private static TreeNodeInfo GetInfo(RiskeerPlugin plugin) { return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(CalculationsStateRootContext));