Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs =================================================================== diff -u -r02b7a16305179c5d4d67fe9bff0fe8b61db983e6 -r1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 02b7a16305179c5d4d67fe9bff0fe8b61db983e6) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1) @@ -462,59 +462,41 @@ } [Test] - public void AddHydraulicBoundaryLocationCalculations_HydraulicBoundaryLocationNull_ThrowsArgumentNullException() + public void SetHydraulicBoundaryLocationCalculations_HydraulicBoundaryLocationsNull_ThrowsArgumentNullException() { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call - TestDelegate test = () => assessmentSection.AddHydraulicBoundaryLocationCalculations(null); + TestDelegate test = () => assessmentSection.SetHydraulicBoundaryLocationCalculations(null); // Assert string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("hydraulicBoundaryLocation", paramName); + Assert.AreEqual("hydraulicBoundaryLocations", paramName); } [Test] - public void AddHydraulicBoundaryLocationCalculations_HydraulicBoundaryLocation_AddsExpectedCalculations() + public void SetHydraulicBoundaryLocationCalculations_MultipleHydraulicBoundaryLocations_SetsExpectedCalculations() { // Setup - var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + var hydraulicBoundaryLocation1 = new TestHydraulicBoundaryLocation(); + var hydraulicBoundaryLocation2 = new TestHydraulicBoundaryLocation(); + var hydraulicBoundaryLocations = new[] + { + hydraulicBoundaryLocation1, + hydraulicBoundaryLocation2 + }; // Call - assessmentSection.AddHydraulicBoundaryLocationCalculations(hydraulicBoundaryLocation); + assessmentSection.SetHydraulicBoundaryLocationCalculations(hydraulicBoundaryLocations); // Assert - AssertNumberOfHydraulicBoundaryLocationCalculations(assessmentSection, 1); - AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.DesignWaterLevelLocationCalculations1.ElementAt(0), hydraulicBoundaryLocation); - AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.DesignWaterLevelLocationCalculations2.ElementAt(0), hydraulicBoundaryLocation); - AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.DesignWaterLevelLocationCalculations3.ElementAt(0), hydraulicBoundaryLocation); - AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.DesignWaterLevelLocationCalculations4.ElementAt(0), hydraulicBoundaryLocation); - AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightLocationCalculations1.ElementAt(0), hydraulicBoundaryLocation); - AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightLocationCalculations2.ElementAt(0), hydraulicBoundaryLocation); - AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightLocationCalculations3.ElementAt(0), hydraulicBoundaryLocation); - AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightLocationCalculations4.ElementAt(0), hydraulicBoundaryLocation); + AssertNumberOfHydraulicBoundaryLocationCalculations(assessmentSection, 2); + AssertDefaultHydraulicBoundaryLocationCalculations(assessmentSection, 1, hydraulicBoundaryLocation1); + AssertDefaultHydraulicBoundaryLocationCalculations(assessmentSection, 2, hydraulicBoundaryLocation2); } - [Test] - public void ClearHydraulicBoundaryLocationCalculations_Always_ClearsAllHydraulicBoundaryLocationCalculations() - { - // Setup - var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - - assessmentSection.AddHydraulicBoundaryLocationCalculations(new TestHydraulicBoundaryLocation()); - - // Precondition - AssertNumberOfHydraulicBoundaryLocationCalculations(assessmentSection, 1); - - // Call - assessmentSection.ClearHydraulicBoundaryLocationCalculations(); - - // Assert - AssertNumberOfHydraulicBoundaryLocationCalculations(assessmentSection, 0); - } - private static IFailureMechanism[] GetExpectedContributingFailureMechanisms(AssessmentSection section) { return new IFailureMechanism[] @@ -694,6 +676,18 @@ Assert.AreEqual(expectedNumberOfCalculations, assessmentSection.WaveHeightLocationCalculations4.Count()); } + private static void AssertDefaultHydraulicBoundaryLocationCalculations(AssessmentSection assessmentSection, int index, HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.DesignWaterLevelLocationCalculations1.ElementAt(index), hydraulicBoundaryLocation); + AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.DesignWaterLevelLocationCalculations2.ElementAt(index), hydraulicBoundaryLocation); + AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.DesignWaterLevelLocationCalculations3.ElementAt(index), hydraulicBoundaryLocation); + AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.DesignWaterLevelLocationCalculations4.ElementAt(index), hydraulicBoundaryLocation); + AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightLocationCalculations1.ElementAt(index), hydraulicBoundaryLocation); + AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightLocationCalculations2.ElementAt(index), hydraulicBoundaryLocation); + AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightLocationCalculations3.ElementAt(index), hydraulicBoundaryLocation); + AssertDefaultHydraulicBoundaryLocationCalculation(assessmentSection.WaveHeightLocationCalculations4.ElementAt(index), hydraulicBoundaryLocation); + } + private static void AssertDefaultHydraulicBoundaryLocationCalculation(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation, HydraulicBoundaryLocation hydraulicBoundaryLocation) {