Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Service/ClosingStructuresDataSynchronizationService.cs =================================================================== diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -rdcf38b56892032a9330058f71a7778bb550b0d30 --- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Service/ClosingStructuresDataSynchronizationService.cs (.../ClosingStructuresDataSynchronizationService.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1) +++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Service/ClosingStructuresDataSynchronizationService.cs (.../ClosingStructuresDataSynchronizationService.cs) (revision dcf38b56892032a9330058f71a7778bb550b0d30) @@ -127,21 +127,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(ClosingStructuresFailureMechanism failureMechanism) + /// Thrown when any parameter is null. + public static IEnumerable ClearAllCalculationOutputAndHydraulicBoundaryLocations( + ClosingStructuresFailureMechanism 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/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs =================================================================== diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -rdcf38b56892032a9330058f71a7778bb550b0d30 --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs (.../ClosingStructureDataSynchronizationServiceTest.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs (.../ClosingStructureDataSynchronizationServiceTest.cs) (revision dcf38b56892032a9330058f71a7778bb550b0d30) @@ -274,16 +274,29 @@ } [Test] - public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_WithoutFailureMechanism_ThrowsArgumentNullException() + public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_FailureMechanismNull_ThrowsArgumentNullException() { // Call - void Call() => ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(null); + void Call() => ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + null, Enumerable.Empty()); // Assert var exception = Assert.Throws(Call); Assert.AreEqual("failureMechanism", exception.ParamName); } + + [Test] + public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_HydraulicBoundaryLocationsNull_ThrowsArgumentNullException() + { + // Call + void Call() => ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + new ClosingStructuresFailureMechanism(), null); + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("hydraulicBoundaryLocations", exception.ParamName); + } + [Test] public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_CalculationsWithHydraulicBoundaryLocationAndOutput_ClearsHydraulicBoundaryLocationAndCalculationsAndReturnsAffectedObjects() { @@ -316,7 +329,8 @@ failureMechanism.CalculationsGroup.Children.Add(calculation3); // Call - IEnumerable affectedItems = ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism); + IEnumerable affectedItems = ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + failureMechanism, Enumerable.Empty()); // Assert // Note: To make sure the clear is performed regardless of what is done with @@ -366,7 +380,8 @@ failureMechanism.CalculationsGroup.Children.Add(calculation3); // Call - IEnumerable affectedItems = ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism); + IEnumerable affectedItems = ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + failureMechanism, Enumerable.Empty()); // Assert // Note: To make sure the clear is performed regardless of what is done with @@ -406,7 +421,8 @@ failureMechanism.CalculationsGroup.Children.Add(calculation3); // Call - IEnumerable affectedItems = ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism); + IEnumerable affectedItems = ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + failureMechanism, Enumerable.Empty()); // Assert // Note: To make sure the clear is performed regardless of what is done with @@ -438,7 +454,8 @@ failureMechanism.CalculationsGroup.Children.Add(calculation3); // Call - IEnumerable affectedItems = ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(failureMechanism); + IEnumerable affectedItems = ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + failureMechanism, Enumerable.Empty()); // Assert CollectionAssert.IsEmpty(affectedItems); Index: Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs =================================================================== diff -u -rce8302b77e7287363c5af195c706381e4e0cdfd0 -rdcf38b56892032a9330058f71a7778bb550b0d30 --- Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs (.../RiskeerDataSynchronizationService.cs) (revision ce8302b77e7287363c5af195c706381e4e0cdfd0) +++ Riskeer/Integration/src/Riskeer.Integration.Service/RiskeerDataSynchronizationService.cs (.../RiskeerDataSynchronizationService.cs) (revision dcf38b56892032a9330058f71a7778bb550b0d30) @@ -114,7 +114,8 @@ heightStructuresFailureMechanism, hydraulicBoundaryLocations)); break; case ClosingStructuresFailureMechanism closingStructuresFailureMechanism: - changedObservables.AddRange(ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(closingStructuresFailureMechanism)); + changedObservables.AddRange(ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations( + closingStructuresFailureMechanism, hydraulicBoundaryLocations)); break; case StabilityPointStructuresFailureMechanism stabilityPointStructuresFailureMechanism: changedObservables.AddRange(StabilityPointStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(stabilityPointStructuresFailureMechanism));