Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs =================================================================== diff -u -re42bdf3dd379c46bab9212eb7b30f4754c9bc91c -r9ee8f17742a5407fd9453aeb12f20cfedb20c73e --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision e42bdf3dd379c46bab9212eb7b30f4754c9bc91c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision 9ee8f17742a5407fd9453aeb12f20cfedb20c73e) @@ -25,6 +25,8 @@ using Application.Ringtoets.Storage.TestUtil; using Core.Common.Base.Geometry; using NUnit.Framework; +using Ringtoets.ClosingStructures.Data; +using Ringtoets.ClosingStructures.Data.TestUtil; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.GrassCoverErosionInwards.Data; @@ -638,6 +640,67 @@ Assert.IsFalse(result); } + [Test] + public void Contains_WithoutClosingStructure_ThrowsArgumentNullException() + { + // Setup + var registry = new PersistenceRegistry(); + + // Call + TestDelegate call = () => registry.Contains((ClosingStructure)null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("model", paramName); + } + + [Test] + public void Contains_ClosingStructureAdded_ReturnsTrue() + { + // Setup + ClosingStructure closingStructure = new TestClosingStructure(); + var registry = new PersistenceRegistry(); + registry.Register(new ClosingStructureEntity(), closingStructure); + + // Call + bool result = registry.Contains(closingStructure); + + // Assert + Assert.IsTrue(result); + } + + [Test] + public void Contains_OtherClosingStructureAdded_ReturnsFalse() + { + // Setup + ClosingStructure closingStructure = new TestClosingStructure(); + + ClosingStructure otherStructure = new TestClosingStructure(); + var registry = new PersistenceRegistry(); + registry.Register(new ClosingStructureEntity(), otherStructure); + + // Call + bool result = registry.Contains(closingStructure); + + // Assert + Assert.IsFalse(result); + } + + [Test] + public void Contains_NoClosingStructureAdded_ReturnsFalse() + { + // Setup + ClosingStructure closingStructure = new TestClosingStructure(); + + var registry = new PersistenceRegistry(); + + // Call + bool result = registry.Contains(closingStructure); + + // Assert + Assert.IsFalse(result); + } + #endregion #region Get methods