Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs =================================================================== diff -u -rb2fa3c06d32059473875aa82186750d50740606b -r12cec002453a1828efc68633fbd25219632c6c47 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs (.../HeightStructuresDataSynchronizationServiceTest.cs) (revision b2fa3c06d32059473875aa82186750d50740606b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresDataSynchronizationServiceTest.cs (.../HeightStructuresDataSynchronizationServiceTest.cs) (revision 12cec002453a1828efc68633fbd25219632c6c47) @@ -25,6 +25,7 @@ using Core.Common.Base; using Core.Common.Base.Geometry; using NUnit.Framework; +using Ringtoets.Common.Data; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -334,7 +335,11 @@ CollectionAssert.IsNotEmpty(sectionResultsWithStructure); // Call - IEnumerable affectedObjects = HeightStructuresDataSynchronizationService.RemoveStructure(failureMechanism, structure); + IEnumerable affectedObjects = RingtoetsCommonDataSynchronizationService.RemoveStructure( + structure, + failureMechanism.Calculations.Cast>(), + failureMechanism.HeightStructures, + failureMechanism.SectionResults); // Assert // Note: To make sure the clear is performed regardless of what is done with @@ -374,17 +379,48 @@ } [Test] - public void RemoveAllStructures_FailureMechanismNull_ThrowsArgumentNullException() + public void RemoveAllStructures_CalculationsNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => HeightStructuresDataSynchronizationService.RemoveAllStructures(null); + TestDelegate call = () => RingtoetsCommonDataSynchronizationService.RemoveAllStructures( + null, + new StructureCollection(), + Enumerable.Empty>()); // Assert string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("failureMechanism", paramName); + Assert.AreEqual("calculations", paramName); } [Test] + public void RemoveAllStructures_StructuresNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => RingtoetsCommonDataSynchronizationService.RemoveAllStructures( + Enumerable.Empty>(), + null, + Enumerable.Empty>()); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("structures", paramName); + } + + [Test] + public void RemoveAllStructures_SectionResultsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => RingtoetsCommonDataSynchronizationService.RemoveAllStructures( + Enumerable.Empty>(), + new StructureCollection(), + null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("sectionResults", paramName); + } + + [Test] public void RemoveAllStructures_FullyConfiguredFailureMechanism_RemoveAllHeightStructuresAndClearDependentData() { // Setup @@ -404,7 +440,10 @@ CollectionAssert.IsNotEmpty(calculationsWithStructure); // Call - IEnumerable observables = HeightStructuresDataSynchronizationService.RemoveAllStructures(failureMechanism); + IEnumerable observables = RingtoetsCommonDataSynchronizationService.RemoveAllStructures( + failureMechanism.Calculations.Cast>(), + failureMechanism.HeightStructures, + failureMechanism.SectionResults); // Assert // Note: To make sure the clear is performed regardless of what is done with