Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs
===================================================================
diff -u -r49f7b4017b243a75ba015ee9cae24e805339cefd -r1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1
--- Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs (.../IAssessmentSection.cs) (revision 49f7b4017b243a75ba015ee9cae24e805339cefd)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/IAssessmentSection.cs (.../IAssessmentSection.cs) (revision 1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1)
@@ -127,15 +127,10 @@
void ChangeComposition(AssessmentSectionComposition newComposition);
///
- /// Adds hydraulic boundary location calculations for .
+ /// Sets hydraulic boundary location calculations for .
///
- /// The hydraulic boundary location to add calculations for.
- /// Thrown when is null.
- void AddHydraulicBoundaryLocationCalculations(HydraulicBoundaryLocation hydraulicBoundaryLocation);
-
- ///
- /// Clears all currently added hydraulic boundary location calculations.
- ///
- void ClearHydraulicBoundaryLocationCalculations();
+ /// The hydraulic boundary locations to add calculations for.
+ /// Thrown when is null.
+ void SetHydraulicBoundaryLocationCalculations(IEnumerable hydraulicBoundaryLocations);
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ObservableTestAssessmentSectionStubTest.cs
===================================================================
diff -u -rf73623ee38f93c2ee85817dc253b5cba1d6cea42 -r1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ObservableTestAssessmentSectionStubTest.cs (.../ObservableTestAssessmentSectionStubTest.cs) (revision f73623ee38f93c2ee85817dc253b5cba1d6cea42)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ObservableTestAssessmentSectionStubTest.cs (.../ObservableTestAssessmentSectionStubTest.cs) (revision 1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1)
@@ -110,33 +110,18 @@
}
[Test]
- public void AddHydraulicBoundaryLocationCalculations_Call_ThrowsNotImplementedException()
+ public void SetHydraulicBoundaryLocationCalculations_Call_ThrowsNotImplementedException()
{
// Setup
var assessmentSection = new ObservableTestAssessmentSectionStub();
// Call
- TestDelegate call = () => assessmentSection.AddHydraulicBoundaryLocationCalculations(new TestHydraulicBoundaryLocation());
+ TestDelegate call = () => assessmentSection.SetHydraulicBoundaryLocationCalculations(Enumerable.Empty());
// Assert
string message = Assert.Throws(call).Message;
const string expectedMessage = "Stub only verifies Observable and basic behaviour, use a proper stub when this function is necessary.";
Assert.AreEqual(expectedMessage, message);
}
-
- [Test]
- public void ClearHydraulicBoundaryLocationCalculations_Call_ThrowsNotImplementedException()
- {
- // Setup
- var assessmentSection = new ObservableTestAssessmentSectionStub();
-
- // Call
- TestDelegate call = () => assessmentSection.ClearHydraulicBoundaryLocationCalculations();
-
- // Assert
- string message = Assert.Throws(call).Message;
- const string expectedMessage = "Stub only verifies Observable and basic behaviour, use a proper stub when this function is necessary.";
- Assert.AreEqual(expectedMessage, message);
- }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs
===================================================================
diff -u -rf73623ee38f93c2ee85817dc253b5cba1d6cea42 -r1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs (.../ObservableTestAssessmentSectionStub.cs) (revision f73623ee38f93c2ee85817dc253b5cba1d6cea42)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ObservableTestAssessmentSectionStub.cs (.../ObservableTestAssessmentSectionStub.cs) (revision 1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1)
@@ -77,14 +77,9 @@
throw new NotImplementedException("Stub only verifies Observable and basic behaviour, use a proper stub when this function is necessary.");
}
- public void AddHydraulicBoundaryLocationCalculations(HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ public void SetHydraulicBoundaryLocationCalculations(IEnumerable hydraulicBoundaryLocations)
{
throw new NotImplementedException();
}
-
- public void ClearHydraulicBoundaryLocationCalculations()
- {
- throw new NotImplementedException();
- }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs
===================================================================
diff -u -r49f7b4017b243a75ba015ee9cae24e805339cefd -r1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 49f7b4017b243a75ba015ee9cae24e805339cefd)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 1c35f1f2c0ae92e62931a2ceec24fbb28bcbbbd1)
@@ -305,33 +305,19 @@
public BackgroundData BackgroundData { get; }
- public void AddHydraulicBoundaryLocationCalculations(HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ public void SetHydraulicBoundaryLocationCalculations(IEnumerable hydraulicBoundaryLocations)
{
- if (hydraulicBoundaryLocation == null)
+ if (hydraulicBoundaryLocations == null)
{
- throw new ArgumentNullException(nameof(hydraulicBoundaryLocation));
+ throw new ArgumentNullException(nameof(hydraulicBoundaryLocations));
}
- designWaterLevelLocationCalculations1.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
- designWaterLevelLocationCalculations2.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
- designWaterLevelLocationCalculations3.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
- designWaterLevelLocationCalculations4.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
- waveHeightLocationCalculations1.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
- waveHeightLocationCalculations2.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
- waveHeightLocationCalculations3.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
- waveHeightLocationCalculations4.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
- }
+ ClearHydraulicBoundaryLocationCalculations();
- public void ClearHydraulicBoundaryLocationCalculations()
- {
- designWaterLevelLocationCalculations1.Clear();
- designWaterLevelLocationCalculations2.Clear();
- designWaterLevelLocationCalculations3.Clear();
- designWaterLevelLocationCalculations4.Clear();
- waveHeightLocationCalculations1.Clear();
- waveHeightLocationCalculations2.Clear();
- waveHeightLocationCalculations3.Clear();
- waveHeightLocationCalculations4.Clear();
+ foreach (HydraulicBoundaryLocation hydraulicBoundaryLocation in hydraulicBoundaryLocations)
+ {
+ AddHydraulicBoundaryLocationCalculations(hydraulicBoundaryLocation);
+ }
}
public IEnumerable GetFailureMechanisms()
@@ -422,6 +408,30 @@
SetFailureMechanismRelevancy();
}
+ private void ClearHydraulicBoundaryLocationCalculations()
+ {
+ designWaterLevelLocationCalculations1.Clear();
+ designWaterLevelLocationCalculations2.Clear();
+ designWaterLevelLocationCalculations3.Clear();
+ designWaterLevelLocationCalculations4.Clear();
+ waveHeightLocationCalculations1.Clear();
+ waveHeightLocationCalculations2.Clear();
+ waveHeightLocationCalculations3.Clear();
+ waveHeightLocationCalculations4.Clear();
+ }
+
+ private void AddHydraulicBoundaryLocationCalculations(HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ {
+ designWaterLevelLocationCalculations1.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
+ designWaterLevelLocationCalculations2.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
+ designWaterLevelLocationCalculations3.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
+ designWaterLevelLocationCalculations4.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
+ waveHeightLocationCalculations1.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
+ waveHeightLocationCalculations2.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
+ waveHeightLocationCalculations3.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
+ waveHeightLocationCalculations4.Add(new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation));
+ }
+
private void SetFailureMechanismRelevancy()
{
Piping.IsRelevant = Composition != AssessmentSectionComposition.Dune;
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)
{