Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs
===================================================================
diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -r45e769fd026f33507c9f081e823f06954f835ac8
--- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs (.../HeightStructuresDataSynchronizationService.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1)
+++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs (.../HeightStructuresDataSynchronizationService.cs) (revision 45e769fd026f33507c9f081e823f06954f835ac8)
@@ -126,21 +126,29 @@
}
///
- /// Clears the and output for all the calculations
- /// in the .
+ /// Clears the and output for the calculations in the
+ /// that uses an
+ /// from .
///
/// The
/// which contains the calculations.
+ /// The hydraulic boundary locations to clear for.
/// An of objects which are affected by removing data.
- /// Thrown when
- /// is null.
- public static IEnumerable ClearAllCalculationOutputAndHydraulicBoundaryLocations(HeightStructuresFailureMechanism failureMechanism)
+ /// Thrown when any parameter is null.
+ public static IEnumerable ClearAllCalculationOutputAndHydraulicBoundaryLocations(
+ HeightStructuresFailureMechanism failureMechanism,
+ IEnumerable hydraulicBoundaryLocations)
{
if (failureMechanism == null)
{
throw new ArgumentNullException(nameof(failureMechanism));
}
+ if (hydraulicBoundaryLocations == null)
+ {
+ throw new ArgumentNullException(nameof(hydraulicBoundaryLocations));
+ }
+
var affectedItems = new List();
foreach (StructuresCalculation calculation in failureMechanism.Calculations.Cast>())
{
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs
===================================================================
diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -r45e769fd026f33507c9f081e823f06954f835ac8
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs (.../HeightStructuresDataSynchronizationServiceTest.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs (.../HeightStructuresDataSynchronizationServiceTest.cs) (revision 45e769fd026f33507c9f081e823f06954f835ac8)
@@ -274,17 +274,30 @@
}
[Test]
- public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_WithoutFailureMechanism_ThrowsArgumentNullException()
+ public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_FailureMechanismNull_ThrowsArgumentNullException()
{
// Call
- void Call() => HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(null);
+ void Call() => HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(
+ null, Enumerable.Empty());
// Assert
var exception = Assert.Throws(Call);
Assert.AreEqual("failureMechanism", exception.ParamName);
}
[Test]
+ public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_HydraulicBoundaryLocationsNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(
+ new HeightStructuresFailureMechanism(), null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("hydraulicBoundaryLocations", exception.ParamName);
+ }
+
+ [Test]
public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_CalculationsWithHydraulicBoundaryLocationAndOutput_ClearsHydraulicBoundaryLocationAndCalculationsAndReturnsAffectedObjects()
{
// Setup
@@ -316,7 +329,11 @@
failureMechanism.CalculationsGroup.Children.Add(calculation3);
// Call
- IEnumerable affectedItems = HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism);
+ IEnumerable affectedItems = HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(
+ failureMechanism, new[]
+ {
+ hydraulicBoundaryLocation
+ });
// Assert
// Note: To make sure the clear is performed regardless of what is done with
@@ -366,7 +383,11 @@
failureMechanism.CalculationsGroup.Children.Add(calculation3);
// Call
- IEnumerable affectedItems = HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism);
+ IEnumerable affectedItems = HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(
+ failureMechanism, new[]
+ {
+ hydraulicBoundaryLocation
+ });
// Assert
// Note: To make sure the clear is performed regardless of what is done with
@@ -406,7 +427,8 @@
failureMechanism.CalculationsGroup.Children.Add(calculation3);
// Call
- IEnumerable affectedItems = HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism);
+ IEnumerable affectedItems = HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(
+ failureMechanism, Enumerable.Empty());
// Assert
// Note: To make sure the clear is performed regardless of what is done with
@@ -438,7 +460,8 @@
failureMechanism.CalculationsGroup.Children.Add(calculation3);
// Call
- IEnumerable affectedItems = HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism);
+ IEnumerable affectedItems = HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(
+ failureMechanism, Enumerable.Empty());
// Assert
CollectionAssert.IsEmpty(affectedItems);
Index: Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs
===================================================================
diff -u -rdfb53cb2134e17953f0cfa0db2f7f1f776782203 -r45e769fd026f33507c9f081e823f06954f835ac8
--- Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs (.../RiskeerDataSynchronizationService.cs) (revision dfb53cb2134e17953f0cfa0db2f7f1f776782203)
+++ Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs (.../RiskeerDataSynchronizationService.cs) (revision 45e769fd026f33507c9f081e823f06954f835ac8)
@@ -110,7 +110,8 @@
grassCoverErosionOutwardsFailureMechanism, hydraulicBoundaryLocations));
break;
case HeightStructuresFailureMechanism heightStructuresFailureMechanism:
- changedObservables.AddRange(HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(heightStructuresFailureMechanism));
+ changedObservables.AddRange(HeightStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(
+ heightStructuresFailureMechanism, hydraulicBoundaryLocations));
break;
case ClosingStructuresFailureMechanism closingStructuresFailureMechanism:
changedObservables.AddRange(ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(closingStructuresFailureMechanism));