Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs =================================================================== diff -u -r8905298103eb01ce13dd5c1a2f267f879d4fda3e -rce9e1d476f00cfb42ce2a8ab6c762baf5abfd97b --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs (.../ClosingStructureDataSynchronizationServiceTest.cs) (revision 8905298103eb01ce13dd5c1a2f267f879d4fda3e) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs (.../ClosingStructureDataSynchronizationServiceTest.cs) (revision ce9e1d476f00cfb42ce2a8ab6c762baf5abfd97b) @@ -33,6 +33,7 @@ using Ringtoets.Common.Data.Probability; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Service; namespace Ringtoets.ClosingStructures.Service.Test { @@ -277,24 +278,31 @@ // Setup ClosingStructuresFailureMechanism failureMechanism = CreateFullyConfiguredFailureMechanism(); + var expectedRemovedObjects = failureMechanism.Sections.OfType() + .Concat(failureMechanism.SectionResults) + .Concat(failureMechanism.CalculationsGroup.GetAllChildrenRecursive()) + .Concat(failureMechanism.ForeshoreProfiles) + .Concat(failureMechanism.ClosingStructures) + .ToArray(); + // Call - IEnumerable observables = ClosingStructuresDataSynchronizationService.ClearReferenceLineDependentData(failureMechanism); + ClearResults results = ClosingStructuresDataSynchronizationService.ClearReferenceLineDependentData(failureMechanism); // Assert - // Note: To make sure the clear is performed regardless of what is done with - // the return result, no ToArray() should be called before these assertions: CollectionAssert.IsEmpty(failureMechanism.Sections); CollectionAssert.IsEmpty(failureMechanism.SectionResults); CollectionAssert.IsEmpty(failureMechanism.CalculationsGroup.Children); CollectionAssert.IsEmpty(failureMechanism.ForeshoreProfiles); CollectionAssert.IsEmpty(failureMechanism.ClosingStructures); - 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.ClosingStructures); + + CollectionAssert.AreEquivalent(expectedRemovedObjects, results.DeletedObjects); } [Test]