Index: Ringtoets/Integration/src/Ringtoets.Integration.Service/AssessmentSectionCalculationActivityFactory.cs =================================================================== diff -u -ra239b3f889a32a47cd41578a760febc9eb3e6ade -r97ca4ceabc8b32833dc748c7e9e10898e64cfb3c --- Ringtoets/Integration/src/Ringtoets.Integration.Service/AssessmentSectionCalculationActivityFactory.cs (.../AssessmentSectionCalculationActivityFactory.cs) (revision a239b3f889a32a47cd41578a760febc9eb3e6ade) +++ Ringtoets/Integration/src/Ringtoets.Integration.Service/AssessmentSectionCalculationActivityFactory.cs (.../AssessmentSectionCalculationActivityFactory.cs) (revision 97ca4ceabc8b32833dc748c7e9e10898e64cfb3c) @@ -37,13 +37,13 @@ namespace Ringtoets.Integration.Service { /// - /// This class defines a factory method that can be used to create instances of for + /// This class defines factory methods that can be used to create instances of for /// all calculations in an . /// public static class AssessmentSectionCalculationActivityFactory { /// - /// Creates a collection of for all calculations + /// Creates a collection of for all relevant calculations /// in the given . /// /// The assessment section to create the activities for. Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs =================================================================== diff -u -ra1d9b6aafaeff1588e32d5c94514870e010c1318 -r97ca4ceabc8b32833dc748c7e9e10898e64cfb3c --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision a1d9b6aafaeff1588e32d5c94514870e010c1318) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision 97ca4ceabc8b32833dc748c7e9e10898e64cfb3c) @@ -695,7 +695,8 @@ LowerBoundaryRevetment = (RoundedDouble) 1, UpperBoundaryRevetment = (RoundedDouble) 3, LowerBoundaryWaterLevels = (RoundedDouble) 1, - UpperBoundaryWaterLevels = (RoundedDouble) 3 + UpperBoundaryWaterLevels = (RoundedDouble) 3, + Orientation = (RoundedDouble) 10 } }); } @@ -709,13 +710,13 @@ { HydraulicBoundaryLocation = hydraulicBoundaryLocation, CategoryType = AssessmentSectionCategoryType.FactorizedLowerLimitNorm, - ForeshoreProfile = new TestForeshoreProfile(true), UseForeshore = true, UseBreakWater = true, LowerBoundaryRevetment = (RoundedDouble) 1, UpperBoundaryRevetment = (RoundedDouble) 3, LowerBoundaryWaterLevels = (RoundedDouble) 1, - UpperBoundaryWaterLevels = (RoundedDouble) 3 + UpperBoundaryWaterLevels = (RoundedDouble) 3, + Orientation = (RoundedDouble) 10 } }); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/AssessmentSectionCalculationActivityFactoryTest.cs =================================================================== diff -u -r24db785aed22f91c30e538dba8fb9d8d1166c724 -r97ca4ceabc8b32833dc748c7e9e10898e64cfb3c --- Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/AssessmentSectionCalculationActivityFactoryTest.cs (.../AssessmentSectionCalculationActivityFactoryTest.cs) (revision 24db785aed22f91c30e538dba8fb9d8d1166c724) +++ Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/AssessmentSectionCalculationActivityFactoryTest.cs (.../AssessmentSectionCalculationActivityFactoryTest.cs) (revision 97ca4ceabc8b32833dc748c7e9e10898e64cfb3c) @@ -168,182 +168,68 @@ } [Test] - public void CreateActivities_PipingNotRelevant_NoActivitiesCreated() + [TestCaseSource(nameof(GetFailureMechanismTestCases))] + public void CreateActivities_FailureMechanismNotIrrelevant_NoActivitiesCreated( + Action setFailureMechanismIrrelevantAction, + Action addValidCalculationToFailureMechanismAction) { // Setup AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.Piping.IsRelevant = false; + setFailureMechanismIrrelevantAction(assessmentSection); - AddPipingCalculationScenario(assessmentSection, new TestHydraulicBoundaryLocation()); + addValidCalculationToFailureMechanismAction(assessmentSection); // Call IEnumerable activities = AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); // Assert - Assert.AreEqual(0, activities.Count()); + CollectionAssert.IsEmpty(activities); } - [Test] - public void CreateActivities_GrassCoverErosionInwardsNotRelevant_NoActivitiesCreated() + private static IEnumerable GetFailureMechanismTestCases() { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.GrassCoverErosionInwards.IsRelevant = false; - - AddGrassCoverErosionInwardsCalculation(assessmentSection, new TestHydraulicBoundaryLocation()); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); + yield return new TestCaseData(new Action(section => section.Piping.IsRelevant = false), + new Action(section => AddPipingCalculationScenario(section, new TestHydraulicBoundaryLocation()))) + .SetName("Piping"); + yield return new TestCaseData(new Action(section => section.GrassCoverErosionInwards.IsRelevant = false), + new Action(section => AddGrassCoverErosionInwardsCalculation(section, new TestHydraulicBoundaryLocation()))) + .SetName("GrassCoverErosionInwards"); + yield return new TestCaseData(new Action(section => section.MacroStabilityInwards.IsRelevant = false), + new Action(section => AddMacroStabilityInwardsCalculationScenario(section, new TestHydraulicBoundaryLocation()))) + .SetName("MacroStabilityInwards"); + yield return new TestCaseData(new Action(section => section.StabilityStoneCover.IsRelevant = false), + new Action(section => AddStabilityStoneCoverCalculation(section, new TestHydraulicBoundaryLocation()))) + .SetName("StabilityStoneCover"); + yield return new TestCaseData(new Action(section => section.WaveImpactAsphaltCover.IsRelevant = false), + new Action(section => AddWaveImpactAsphaltCoverCalculation(section, new TestHydraulicBoundaryLocation()))) + .SetName("WaveImpactAsphaltCover"); + yield return new TestCaseData(new Action(section => section.GrassCoverErosionOutwards.IsRelevant = false), + new Action(section => AddGrassCoverErosionOutwardsCalculation(section, new TestHydraulicBoundaryLocation()))) + .SetName("GrassCoverErosionOutwards"); + yield return new TestCaseData(new Action(section => section.HeightStructures.IsRelevant = false), + new Action(section => AddHeightStructuresCalculation(section, new TestHydraulicBoundaryLocation()))) + .SetName("HeightStructures"); + yield return new TestCaseData(new Action(section => section.ClosingStructures.IsRelevant = false), + new Action(section => AddClosingStructuresCalculation(section, new TestHydraulicBoundaryLocation()))) + .SetName("ClosingStructures"); + yield return new TestCaseData(new Action(section => section.StabilityPointStructures.IsRelevant = false), + new Action(section => AddStabilityPointStructuresCalculation(section, new TestHydraulicBoundaryLocation()))) + .SetName("StabilityPointStructures"); + yield return new TestCaseData(new Action(section => section.DuneErosion.IsRelevant = false), + new Action(AddDuneLocationCalculation)) + .SetName("DuneErosion"); } - [Test] - public void CreateActivities_MacroStabilityInwardsNotRelevant_NoActivitiesCreated() - { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.MacroStabilityInwards.IsRelevant = false; - - AddMacroStabilityInwardsCalculationScenario(assessmentSection, new TestHydraulicBoundaryLocation()); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); - } - - [Test] - public void CreateActivities_StabilityStoneCoverNotRelevant_NoActivitiesCreated() - { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.StabilityStoneCover.IsRelevant = false; - - AddStabilityStoneCoverCalculation(assessmentSection, new TestHydraulicBoundaryLocation()); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); - } - - [Test] - public void CreateActivities_WaveImpactAsphaltCoverNotRelevant_NoActivitiesCreated() - { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.WaveImpactAsphaltCover.IsRelevant = false; - - AddWaveImpactAsphaltCoverCalculation(assessmentSection, new TestHydraulicBoundaryLocation()); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); - } - - [Test] - public void CreateActivities_GrassCoverErosionOutwardsNotRelevant_NoActivitiesCreated() - { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.GrassCoverErosionOutwards.IsRelevant = false; - - AddGrassCoverErosionOutwardsCalculation(assessmentSection, new TestHydraulicBoundaryLocation()); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); - } - - [Test] - public void CreateActivities_HeightStructuresNotRelevant_NoActivitiesCreated() - { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.HeightStructures.IsRelevant = false; - - AddHeightStructuresCalculation(assessmentSection, new TestHydraulicBoundaryLocation()); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); - } - - [Test] - public void CreateActivities_ClosingStructuresNotRelevant_NoActivitiesCreated() - { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.ClosingStructures.IsRelevant = false; - - AddClosingStructuresCalculation(assessmentSection, new TestHydraulicBoundaryLocation()); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); - } - - [Test] - public void CreateActivities_StabilityPointStructuresNotRelevant_NoActivitiesCreated() - { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.StabilityPointStructures.IsRelevant = false; - - AddStabilityPointStructuresCalculation(assessmentSection, new TestHydraulicBoundaryLocation()); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); - } - - [Test] - public void CreateActivities_DuneErosionNotRelevant_NoActivitiesCreated() - { - // Setup - AssessmentSection assessmentSection = CreateAssessmentSection(); - assessmentSection.DuneErosion.IsRelevant = false; - - AddDuneLocationCalculation(assessmentSection); - - // Call - IEnumerable activities = - AssessmentSectionCalculationActivityFactory.CreateActivities(assessmentSection); - - // Assert - Assert.AreEqual(0, activities.Count()); - } - private static AssessmentSection CreateAssessmentSection() { - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.DikeAndDune); - - assessmentSection.HydraulicBoundaryDatabase.FilePath = Path.Combine(testDataPath, "HRD ijsselmeer.sqlite"); - - return assessmentSection; + return new AssessmentSection(AssessmentSectionComposition.DikeAndDune) + { + HydraulicBoundaryDatabase = + { + FilePath = Path.Combine(testDataPath, "HRD ijsselmeer.sqlite") + } + }; } private static void AddGrassCoverErosionInwardsCalculation(AssessmentSection assessmentSection, @@ -387,13 +273,13 @@ { HydraulicBoundaryLocation = hydraulicBoundaryLocation, CategoryType = AssessmentSectionCategoryType.FactorizedLowerLimitNorm, - ForeshoreProfile = new TestForeshoreProfile(true), UseForeshore = true, UseBreakWater = true, LowerBoundaryRevetment = (RoundedDouble) 1, UpperBoundaryRevetment = (RoundedDouble) 3, LowerBoundaryWaterLevels = (RoundedDouble) 1, - UpperBoundaryWaterLevels = (RoundedDouble) 3 + UpperBoundaryWaterLevels = (RoundedDouble) 3, + Orientation = (RoundedDouble) 10 } }); } @@ -407,13 +293,13 @@ { HydraulicBoundaryLocation = hydraulicBoundaryLocation, CategoryType = AssessmentSectionCategoryType.FactorizedLowerLimitNorm, - ForeshoreProfile = new TestForeshoreProfile(true), UseForeshore = true, UseBreakWater = true, LowerBoundaryRevetment = (RoundedDouble) 1, UpperBoundaryRevetment = (RoundedDouble) 3, LowerBoundaryWaterLevels = (RoundedDouble) 1, - UpperBoundaryWaterLevels = (RoundedDouble) 3 + UpperBoundaryWaterLevels = (RoundedDouble) 3, + Orientation = (RoundedDouble) 10 } }); }