Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresDataSynchronizationServiceTest.cs =================================================================== diff -u -r8905298103eb01ce13dd5c1a2f267f879d4fda3e -rce9e1d476f00cfb42ce2a8ab6c762baf5abfd97b --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresDataSynchronizationServiceTest.cs (.../StabilityPointStructuresDataSynchronizationServiceTest.cs) (revision 8905298103eb01ce13dd5c1a2f267f879d4fda3e) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresDataSynchronizationServiceTest.cs (.../StabilityPointStructuresDataSynchronizationServiceTest.cs) (revision ce9e1d476f00cfb42ce2a8ab6c762baf5abfd97b) @@ -29,6 +29,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Service; using Ringtoets.StabilityPointStructures.Data; using Ringtoets.StabilityPointStructures.Data.TestUtil; @@ -124,8 +125,15 @@ // Setup StabilityPointStructuresFailureMechanism failureMechanism = CreateFullyConfiguredFailureMechanism(); + var expectedRemovedObjects = failureMechanism.Sections.OfType() + .Concat(failureMechanism.SectionResults) + .Concat(failureMechanism.CalculationsGroup.GetAllChildrenRecursive()) + .Concat(failureMechanism.ForeshoreProfiles) + .Concat(failureMechanism.StabilityPointStructures) + .ToArray(); + // Call - IEnumerable observables = StabilityPointStructuresDataSynchronizationService.ClearReferenceLineDependentData(failureMechanism); + ClearResults results = StabilityPointStructuresDataSynchronizationService.ClearReferenceLineDependentData(failureMechanism); // Assert // Note: To make sure the clear is performed regardless of what is done with @@ -136,12 +144,14 @@ CollectionAssert.IsEmpty(failureMechanism.ForeshoreProfiles); CollectionAssert.IsEmpty(failureMechanism.StabilityPointStructures); - IObservable[] array = observables.ToArray(); + IObservable[] array = results.ChangedObjects.ToArray(); Assert.AreEqual(4, array.Length); CollectionAssert.Contains(array, failureMechanism); CollectionAssert.Contains(array, failureMechanism.CalculationsGroup); CollectionAssert.Contains(array, failureMechanism.ForeshoreProfiles); CollectionAssert.Contains(array, failureMechanism.StabilityPointStructures); + + CollectionAssert.AreEquivalent(expectedRemovedObjects, results.DeletedObjects); } [Test]