Index: Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs =================================================================== diff -u -r48a9e367fc98a59df480ad2486be9eec0e629703 -r8e0365384823f022fbae3bb8104439c538fea0ba --- Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs (.../RiskeerDataSynchronizationService.cs) (revision 48a9e367fc98a59df480ad2486be9eec0e629703) +++ Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs (.../RiskeerDataSynchronizationService.cs) (revision 8e0365384823f022fbae3bb8104439c538fea0ba) @@ -118,7 +118,8 @@ closingStructuresFailureMechanism, hydraulicBoundaryLocations)); break; case StabilityPointStructuresFailureMechanism stabilityPointStructuresFailureMechanism: - changedObservables.AddRange(StabilityPointStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(stabilityPointStructuresFailureMechanism)); + changedObservables.AddRange(StabilityPointStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + stabilityPointStructuresFailureMechanism, hydraulicBoundaryLocations)); break; case MacroStabilityInwardsFailureMechanism macroStabilityInwardsFailureMechanism: changedObservables.AddRange(MacroStabilityInwardsDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(macroStabilityInwardsFailureMechanism)); Index: Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs =================================================================== diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -r8e0365384823f022fbae3bb8104439c538fea0ba --- Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs (.../StabilityPointStructuresDataSynchronizationService.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1) +++ Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Service/StabilityPointStructuresDataSynchronizationService.cs (.../StabilityPointStructuresDataSynchronizationService.cs) (revision 8e0365384823f022fbae3bb8104439c538fea0ba) @@ -125,22 +125,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. + /// Thrown when any parameter is null. public static IEnumerable ClearAllCalculationOutputAndHydraulicBoundaryLocations( - StabilityPointStructuresFailureMechanism failureMechanism) + StabilityPointStructuresFailureMechanism 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/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Service.Test/StabilityPointStructuresDataSynchronizationServiceTest.cs =================================================================== diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -r8e0365384823f022fbae3bb8104439c538fea0ba --- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Service.Test/StabilityPointStructuresDataSynchronizationServiceTest.cs (.../StabilityPointStructuresDataSynchronizationServiceTest.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1) +++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Service.Test/StabilityPointStructuresDataSynchronizationServiceTest.cs (.../StabilityPointStructuresDataSynchronizationServiceTest.cs) (revision 8e0365384823f022fbae3bb8104439c538fea0ba) @@ -27,6 +27,7 @@ using NUnit.Framework; using Riskeer.Common.Data.Calculation; using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Data.Structures; using Riskeer.Common.Data.TestUtil; using Riskeer.Common.Service; @@ -160,14 +161,27 @@ public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_FailureMechanismNull_ThrowsArgumentNullException() { // Call - void Call() => StabilityPointStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(null); + void Call() => StabilityPointStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + null, Enumerable.Empty()); // Assert var exception = Assert.Throws(Call); Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] + public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_HydraulicBoundaryLocationsNull_ThrowsArgumentNullException() + { + // Call + void Call() => StabilityPointStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + new StabilityPointStructuresFailureMechanism(), null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("hydraulicBoundaryLocations", exception.ParamName); + } + + [Test] public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_WithVariousCalculations_ClearsCalculationsOutputAndReturnsAffectedObjects() { // Setup @@ -182,8 +196,8 @@ .ToArray(); // Call - IEnumerable affectedItems = - StabilityPointStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism); + IEnumerable affectedItems = StabilityPointStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + failureMechanism, Enumerable.Empty()); // Assert // Note: To make sure the clear is performed regardless of what is done with