Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs =================================================================== diff -u -r0ca80ea0128c50442c9ab707f715125d65cf7fa0 -rd9bbfea8e0f8e620379c9b51e427d24560b7cbd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision 0ca80ea0128c50442c9ab707f715125d65cf7fa0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision d9bbfea8e0f8e620379c9b51e427d24560b7cbd4) @@ -53,184 +53,6 @@ [TestFixture] public class PersistenceRegistryTest { - private static DikeProfile CreateDikeProfile() - { - return new DikeProfile(new Point2D(0, 0), - new[] - { - new RoughnessPoint(new Point2D(1, 2), 0.75), - new RoughnessPoint(new Point2D(3, 4), 0.75) - }, - new[] - { - new Point2D(5, 6), - new Point2D(7, 8) - }, - null, new DikeProfile.ConstructionProperties - { - Id = "id" - }); - } - - [TestFixture] - private class PipingStochasticSoilModelRegistryTest : RegistryTest - { - public PipingStochasticSoilModelRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override MacroStabilityInwardsStochasticSoilModel CreateDataModel() - { - return new MacroStabilityInwardsStochasticSoilModel(nameof(MacroStabilityInwardsStochasticSoilModel)); - } - } - - [TestFixture] - private class PipingStochasticSoilProfileRegistryTest : RegistryTest - { - public PipingStochasticSoilProfileRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override PipingStochasticSoilProfile CreateDataModel() - { - return new PipingStochasticSoilProfile(0.2, PipingSoilProfileTestFactory.CreatePipingSoilProfile()); - } - } - - [TestFixture] - private class PipingSoilProfileRegistryTest : RegistryTest - { - public PipingSoilProfileRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override PipingSoilProfile CreateDataModel() - { - return PipingSoilProfileTestFactory.CreatePipingSoilProfile(); - } - } - - [TestFixture] - private class PipingSurfaceLineRegistryTest : RegistryTest - { - public PipingSurfaceLineRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override PipingSurfaceLine CreateDataModel() - { - return new PipingSurfaceLine(nameof(PipingSurfaceLine)); - } - } - - [TestFixture] - private class MacroStabilityInwardsStochasticSoilModelRegistryTest : RegistryTest - { - public MacroStabilityInwardsStochasticSoilModelRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override MacroStabilityInwardsStochasticSoilModel CreateDataModel() - { - return new MacroStabilityInwardsStochasticSoilModel(nameof(MacroStabilityInwardsStochasticSoilModel)); - } - } - - [TestFixture] - private class MacroStabilityInwardsStochasticSoilProfileRegistryTest : RegistryTest - { - private MockRepository mockRepository; - - [SetUp] - public void Setup() - { - mockRepository = new MockRepository(); - } - - [TearDown] - public void TearDown() - { - mockRepository.VerifyAll(); - } - - public MacroStabilityInwardsStochasticSoilProfileRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override MacroStabilityInwardsStochasticSoilProfile CreateDataModel() - { - var soilProfile = mockRepository.Stub(); - mockRepository.ReplayAll(); - - return new MacroStabilityInwardsStochasticSoilProfile(0, soilProfile); - } - } - - [TestFixture] - private class MacroStabilityInwardsSoilProfileOneDRegistryTest : RegistryTest - { - public MacroStabilityInwardsSoilProfileOneDRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override MacroStabilityInwardsSoilProfile1D CreateDataModel() - { - return MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(); - } - } - - [TestFixture] - private class MacroStabilityInwardsSoilProfileTwoDRegistryTest : RegistryTest - { - public MacroStabilityInwardsSoilProfileTwoDRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override MacroStabilityInwardsSoilProfile2D CreateDataModel() - { - return new MacroStabilityInwardsSoilProfile2D("", new[] - { - new MacroStabilityInwardsSoilLayer2D(new Ring(new[] - { - new Point2D(0, 0), - new Point2D(1, 1) - }), new Ring[0]) - }, Enumerable.Empty()); - } - } - - [TestFixture] - private class MacroStabilityInwardsSurfaceLineRegistryTest : RegistryTest - { - public MacroStabilityInwardsSurfaceLineRegistryTest() : base( - (r, e, m) => r.Register(e, m), - (r, m) => r.Contains(m), - (r, m) => r.Get(m)) {} - - protected override MacroStabilityInwardsSurfaceLine CreateDataModel() - { - return new MacroStabilityInwardsSurfaceLine(nameof(MacroStabilityInwardsSurfaceLine)); - } - } - /// /// Test class to test the for the combination of /// and . @@ -434,1712 +256,390 @@ protected abstract TDataModel CreateDataModel(); } - #region Contains methods - - [Test] - public void Contains_WithoutHydraulicBoundaryLocation_ThrowsArgumentNullException() + [TestFixture] + private class HydraulicBoundaryLocationRegistryTest : RegistryTest { - // Setup - var registry = new PersistenceRegistry(); + public HydraulicBoundaryLocationRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - TestDelegate test = () => registry.Contains((HydraulicBoundaryLocation) null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); + protected override HydraulicBoundaryLocation CreateDataModel() + { + return new TestHydraulicBoundaryLocation(nameof(HydraulicBoundaryLocation)); + } } - [Test] - public void Contains_HydraulicBoundaryLocationAdded_ReturnsTrue() + [TestFixture] + private class FailureMechanismSectionRegistryTest : RegistryTest { - // Setup - var registry = new PersistenceRegistry(); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 1, 2); - registry.Register(new HydraulicLocationEntity(), hydraulicBoundaryLocation); + public FailureMechanismSectionRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(hydraulicBoundaryLocation); - - // Assert - Assert.IsTrue(result); + protected override FailureMechanismSection CreateDataModel() + { + return new TestFailureMechanismSection(); + } } - [Test] - public void Contains_NoHydraulicBoundaryLocationAdded_ReturnsFalse() + [TestFixture] + private class DikeProfileRegistryTest : RegistryTest { - // Setup - var registry = new PersistenceRegistry(); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 1, 2); + public DikeProfileRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(hydraulicBoundaryLocation); - - // Assert - Assert.IsFalse(result); + protected override DikeProfile CreateDataModel() + { + return new TestDikeProfile(); + } } - [Test] - public void Contains_OtherHydraulicBoundaryLocationAdded_ReturnsFalse() + [TestFixture] + private class ForeshoreProfileRegistryTest : RegistryTest { - // Setup - var registry = new PersistenceRegistry(); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 1, 2); - registry.Register(new HydraulicLocationEntity(), new HydraulicBoundaryLocation(3, "B", 4, 5)); + public ForeshoreProfileRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(hydraulicBoundaryLocation); - - // Assert - Assert.IsFalse(result); + protected override ForeshoreProfile CreateDataModel() + { + return new TestForeshoreProfile(); + } } - [Test] - public void Contains_WithoutDuneLocation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); + #region DuneErosion - // Call - TestDelegate test = () => registry.Contains((DuneLocation) null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Contains_DuneLocationAdded_ReturnsTrue() + [TestFixture] + private class DuneLocationRegistryTest : RegistryTest { - // Setup - var registry = new PersistenceRegistry(); - var duneLocation = new TestDuneLocation(); - registry.Register(new DuneLocationEntity(), duneLocation); + public DuneLocationRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(duneLocation); - - // Assert - Assert.IsTrue(result); + protected override DuneLocation CreateDataModel() + { + return new TestDuneLocation(nameof(DuneLocation)); + } } - [Test] - public void Contains_NoDuneLocationAdded_ReturnsFalse() - { - // Setup - var registry = new PersistenceRegistry(); - var duneLocation = new TestDuneLocation(); + #endregion - // Call - bool result = registry.Contains(duneLocation); + #region GrassCoverErosionInwards - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_OtherDuneLocationAdded_ReturnsFalse() + [TestFixture] + private class GrassCoverErosionInwardsCalculationRegistryTest : RegistryTest< + GrassCoverErosionInwardsCalculation, GrassCoverErosionInwardsCalculationEntity> { - // Setup - var registry = new PersistenceRegistry(); - var duneLocation = new TestDuneLocation(); - registry.Register(new DuneLocationEntity(), new TestDuneLocation()); + public GrassCoverErosionInwardsCalculationRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(duneLocation); - - // Assert - Assert.IsFalse(result); + protected override GrassCoverErosionInwardsCalculation CreateDataModel() + { + return new GrassCoverErosionInwardsCalculation(); + } } - [Test] - public void Contains_FailureMechanismSectionAdded_ReturnsTrue() - { - // Setup - var registry = new PersistenceRegistry(); - var failureMechanismSection = new TestFailureMechanismSection(); - registry.Register(new FailureMechanismSectionEntity(), failureMechanismSection); + #endregion - // Call - bool result = registry.Contains(failureMechanismSection); + #region GrassCoverErosionOutwards - // Assert - Assert.IsTrue(result); - } - - [Test] - public void Contains_NoFailureMechanismSectionAdded_ReturnsFalse() + [TestFixture] + private class GrassCoverErosionOutwardsHydraulicBoundaryLocationRegistryTest : RegistryTest< + HydraulicBoundaryLocation, GrassCoverErosionOutwardsHydraulicLocationEntity> { - // Setup - var registry = new PersistenceRegistry(); - var failureMechanismSection = new TestFailureMechanismSection(); + public GrassCoverErosionOutwardsHydraulicBoundaryLocationRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(failureMechanismSection); - - // Assert - Assert.IsFalse(result); + protected override HydraulicBoundaryLocation CreateDataModel() + { + return new TestHydraulicBoundaryLocation(nameof(HydraulicBoundaryLocation)); + } } - [Test] - public void Contains_OtherFailureMechanismSectionAdded_ReturnsFalse() - { - // Setup - var registry = new PersistenceRegistry(); - var failureMechanismSection = new TestFailureMechanismSection(); - registry.Register(new FailureMechanismSectionEntity(), new TestFailureMechanismSection()); + #endregion - // Call - bool result = registry.Contains(failureMechanismSection); + #region Piping - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_WithoutDikeProfile_ThrowsArgumentNullException() + [TestFixture] + private class PipingStochasticSoilModelRegistryTest : RegistryTest { - // Setup - var registry = new PersistenceRegistry(); + public PipingStochasticSoilModelRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - TestDelegate call = () => registry.Contains((DikeProfile) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); + protected override PipingStochasticSoilModel CreateDataModel() + { + return new PipingStochasticSoilModel(nameof(PipingStochasticSoilModel)); + } } - [Test] - public void Contains_DikeProfileAdded_ReturnsTrue() + [TestFixture] + private class PipingStochasticSoilProfileRegistryTest : RegistryTest { - // Setup - DikeProfile dikeProfile = new TestDikeProfile(); - var registry = new PersistenceRegistry(); - registry.Register(new DikeProfileEntity(), dikeProfile); + public PipingStochasticSoilProfileRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(dikeProfile); - - // Assert - Assert.IsTrue(result); + protected override PipingStochasticSoilProfile CreateDataModel() + { + return new PipingStochasticSoilProfile(0.2, PipingSoilProfileTestFactory.CreatePipingSoilProfile()); + } } - [Test] - public void Contains_OtherDikeProfileAdded_ReturnsFalse() + [TestFixture] + private class PipingSoilProfileRegistryTest : RegistryTest { - // Setup - DikeProfile dikeProfile = CreateDikeProfile(); - DikeProfile otherDikeProfile = CreateDikeProfile(); + public PipingSoilProfileRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - var registry = new PersistenceRegistry(); - registry.Register(new DikeProfileEntity(), otherDikeProfile); - - // Call - bool result = registry.Contains(dikeProfile); - - // Assert - Assert.IsFalse(result); + protected override PipingSoilProfile CreateDataModel() + { + return PipingSoilProfileTestFactory.CreatePipingSoilProfile(); + } } - [Test] - public void Contains_NoDikeProfileAdded_ReturnsFalse() + [TestFixture] + private class PipingSurfaceLineRegistryTest : RegistryTest { - // Setup - DikeProfile dikeProfile = CreateDikeProfile(); + public PipingSurfaceLineRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - var registry = new PersistenceRegistry(); - - // Call - bool result = registry.Contains(dikeProfile); - - // Assert - Assert.IsFalse(result); + protected override PipingSurfaceLine CreateDataModel() + { + return new PipingSurfaceLine(nameof(PipingSurfaceLine)); + } } - [Test] - public void Contains_WithoutForeshoreProfile_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); + #endregion - // Call - TestDelegate call = () => registry.Contains((ForeshoreProfile) null); + #region MacroStabilityInwards - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Contains_ForeshoreProfileAdded_ReturnsTrue() + [TestFixture] + private class MacroStabilityInwardsStochasticSoilModelRegistryTest : RegistryTest { - // Setup - var foreshoreProfile = new TestForeshoreProfile(); - var registry = new PersistenceRegistry(); - registry.Register(new ForeshoreProfileEntity(), foreshoreProfile); + public MacroStabilityInwardsStochasticSoilModelRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(foreshoreProfile); - - // Assert - Assert.IsTrue(result); + protected override MacroStabilityInwardsStochasticSoilModel CreateDataModel() + { + return new MacroStabilityInwardsStochasticSoilModel(nameof(MacroStabilityInwardsStochasticSoilModel)); + } } - [Test] - public void Contains_OtherForeshoreProfileAdded_ReturnsFalse() + [TestFixture] + private class MacroStabilityInwardsStochasticSoilProfileRegistryTest : RegistryTest { - // Setup - var foreshoreProfile = new TestForeshoreProfile(); - var otherForeshoreProfile = new TestForeshoreProfile(); + private MockRepository mockRepository; - var registry = new PersistenceRegistry(); - registry.Register(new ForeshoreProfileEntity(), otherForeshoreProfile); + [SetUp] + public void Setup() + { + mockRepository = new MockRepository(); + } - // Call - bool result = registry.Contains(foreshoreProfile); + [TearDown] + public void TearDown() + { + mockRepository.VerifyAll(); + } - // Assert - Assert.IsFalse(result); - } + public MacroStabilityInwardsStochasticSoilProfileRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - [Test] - public void Contains_NoForeshoreProfileAdded_ReturnsFalse() - { - // Setup - var foreshoreProfile = new TestForeshoreProfile(); + protected override MacroStabilityInwardsStochasticSoilProfile CreateDataModel() + { + var soilProfile = mockRepository.Stub(); + mockRepository.ReplayAll(); - var registry = new PersistenceRegistry(); - - // Call - bool result = registry.Contains(foreshoreProfile); - - // Assert - Assert.IsFalse(result); + return new MacroStabilityInwardsStochasticSoilProfile(0, soilProfile); + } } - [Test] - public void Contains_WithoutGrassCoverErosionInwardsCalculation_ThrowsArgumentNullException() + [TestFixture] + private class MacroStabilityInwardsSoilProfileOneDRegistryTest : RegistryTest { - // Setup - var registry = new PersistenceRegistry(); + public MacroStabilityInwardsSoilProfileOneDRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - TestDelegate call = () => registry.Contains((GrassCoverErosionInwardsCalculation) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); + protected override MacroStabilityInwardsSoilProfile1D CreateDataModel() + { + return MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(); + } } - [Test] - public void Contains_GrassCoverErosionInwardsCalculationAdded_ReturnsTrue() + [TestFixture] + private class MacroStabilityInwardsSoilProfileTwoDRegistryTest : RegistryTest { - // Setup - var calculation = new GrassCoverErosionInwardsCalculation(); - var registry = new PersistenceRegistry(); - registry.Register(new GrassCoverErosionInwardsCalculationEntity(), calculation); + public MacroStabilityInwardsSoilProfileTwoDRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsTrue(result); + protected override MacroStabilityInwardsSoilProfile2D CreateDataModel() + { + return new MacroStabilityInwardsSoilProfile2D("", new[] + { + new MacroStabilityInwardsSoilLayer2D(new Ring(new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + }), new Ring[0]) + }, Enumerable.Empty()); + } } - [Test] - public void Contains_OtherGrassCoverErosionInwardsCalculationAdded_ReturnsFalse() + [TestFixture] + private class MacroStabilityInwardsSurfaceLineRegistryTest : RegistryTest { - // Setup - var calculation = new GrassCoverErosionInwardsCalculation(); + public MacroStabilityInwardsSurfaceLineRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - var otherCalculation = new GrassCoverErosionInwardsCalculation(); - var registry = new PersistenceRegistry(); - registry.Register(new GrassCoverErosionInwardsCalculationEntity(), otherCalculation); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsFalse(result); + protected override MacroStabilityInwardsSurfaceLine CreateDataModel() + { + return new MacroStabilityInwardsSurfaceLine(nameof(MacroStabilityInwardsSurfaceLine)); + } } - [Test] - public void Contains_NoGrassCoverErosionInwardsCalculationAdded_ReturnsFalse() - { - // Setup - var calculation = new GrassCoverErosionInwardsCalculation(); + #endregion - var registry = new PersistenceRegistry(); + #region HeightStructures - // Call - bool result = registry.Contains(calculation); + #region StabilityPointStructures - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_WithoutHeightStructure_ThrowsArgumentNullException() + [TestFixture] + private class StabilityPointStructureStructureRegistryTest : RegistryTest< + StabilityPointStructure, StabilityPointStructureEntity> { - // Setup - var registry = new PersistenceRegistry(); + public StabilityPointStructureStructureRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - TestDelegate call = () => registry.Contains((HeightStructure) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); + protected override StabilityPointStructure CreateDataModel() + { + return new TestStabilityPointStructure(); + } } - [Test] - public void Contains_HeightStructureAdded_ReturnsTrue() + [TestFixture] + private class StabilityPointStructuresCalculationRegistryTest : RegistryTest< + StructuresCalculation, StabilityPointStructuresCalculationEntity> { - // Setup - HeightStructure heightStructure = new TestHeightStructure(); - var registry = new PersistenceRegistry(); - registry.Register(new HeightStructureEntity(), heightStructure); + public StabilityPointStructuresCalculationRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - bool result = registry.Contains(heightStructure); - - // Assert - Assert.IsTrue(result); + protected override StructuresCalculation CreateDataModel() + { + return new StructuresCalculation(); + } } - [Test] - public void Contains_OtherHeightStructureAdded_ReturnsFalse() - { - // Setup - HeightStructure heightStructure = new TestHeightStructure(); - - HeightStructure otherStructure = new TestHeightStructure(); - var registry = new PersistenceRegistry(); - registry.Register(new HeightStructureEntity(), otherStructure); - - // Call - bool result = registry.Contains(heightStructure); - - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_NoHeightStructureAdded_ReturnsFalse() - { - // Setup - HeightStructure heightStructure = new TestHeightStructure(); - - var registry = new PersistenceRegistry(); - - // Call - bool result = registry.Contains(heightStructure); - - // Assert - 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); - } - - [Test] - public void Contains_WithoutStabilityPointStructure_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Contains((StabilityPointStructure) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Contains_StabilityPointStructureAdded_ReturnsTrue() - { - // Setup - StabilityPointStructure stabilityPointStructure = new TestStabilityPointStructure(); - var registry = new PersistenceRegistry(); - registry.Register(new StabilityPointStructureEntity(), stabilityPointStructure); - - // Call - bool result = registry.Contains(stabilityPointStructure); - - // Assert - Assert.IsTrue(result); - } - - [Test] - public void Contains_OtherStabilityPointStructureAdded_ReturnsFalse() - { - // Setup - StabilityPointStructure stabilityPointStructure = new TestStabilityPointStructure(); - - StabilityPointStructure otherStructure = new TestStabilityPointStructure(); - var registry = new PersistenceRegistry(); - registry.Register(new StabilityPointStructureEntity(), otherStructure); - - // Call - bool result = registry.Contains(stabilityPointStructure); - - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_NoStabilityPointStructureAdded_ReturnsFalse() - { - // Setup - StabilityPointStructure stabilityPointStructure = new TestStabilityPointStructure(); - - var registry = new PersistenceRegistry(); - - // Call - bool result = registry.Contains(stabilityPointStructure); - - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_WithoutHeightStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Contains((StructuresCalculation) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Contains_HeightStructuresCalculationAdded_ReturnsTrue() - { - // Setup - var calculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - registry.Register(new HeightStructuresCalculationEntity(), calculation); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsTrue(result); - } - - [Test] - public void Contains_OtherHeightStructuresCalculationAdded_ReturnsFalse() - { - // Setup - var calculation = new StructuresCalculation(); - - var otherCalculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - registry.Register(new HeightStructuresCalculationEntity(), otherCalculation); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_NoHeightStructuresCalculationAdded_ReturnsFalse() - { - // Setup - var calculation = new StructuresCalculation(); - - var registry = new PersistenceRegistry(); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_WithoutClosingStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Contains((StructuresCalculation) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Contains_ClosingStructuresCalculationAdded_ReturnsTrue() - { - // Setup - var calculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - registry.Register(new ClosingStructuresCalculationEntity(), calculation); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsTrue(result); - } - - [Test] - public void Contains_OtherClosingStructuresCalculationAdded_ReturnsFalse() - { - // Setup - var calculation = new StructuresCalculation(); - - var otherCalculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - registry.Register(new ClosingStructuresCalculationEntity(), otherCalculation); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_NoClosingStructuresCalculationAdded_ReturnsFalse() - { - // Setup - var calculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_WithoutStabilityPointStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Contains((StructuresCalculation) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Contains_StabilityPointStructuresCalculationAdded_ReturnsTrue() - { - // Setup - var calculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - registry.Register(new StabilityPointStructuresCalculationEntity(), calculation); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsTrue(result); - } - - [Test] - public void Contains_OtherStabilityPointStructuresCalculationAdded_ReturnsFalse() - { - // Setup - var calculation = new StructuresCalculation(); - - var otherCalculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - registry.Register(new StabilityPointStructuresCalculationEntity(), otherCalculation); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsFalse(result); - } - - [Test] - public void Contains_NoStabilityPointStructuresCalculationAdded_ReturnsFalse() - { - // Setup - var calculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - - // Call - bool result = registry.Contains(calculation); - - // Assert - Assert.IsFalse(result); - } - #endregion - #region Get methods - - [Test] - public void Get_WithoutHydraulicBoundaryLocation_ThrowsArgumentNullException() + [TestFixture] + private class HeightStructureRegistryTest : RegistryTest< + HeightStructure, HeightStructureEntity> { - // Setup - var registry = new PersistenceRegistry(); + public HeightStructureRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - TestDelegate test = () => registry.Get(null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); + protected override HeightStructure CreateDataModel() + { + return new TestHeightStructure(); + } } - [Test] - public void Get_HydraulicBoundaryLocationAdded_ReturnsEntity() + [TestFixture] + private class HeightStructuresCalculationRegistryTest : RegistryTest< + StructuresCalculation, HeightStructuresCalculationEntity> { - // Setup - var registry = new PersistenceRegistry(); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(5, "6", 7, 8); - var entity = new HydraulicLocationEntity(); - registry.Register(entity, hydraulicBoundaryLocation); + public HeightStructuresCalculationRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - var result = registry.Get(hydraulicBoundaryLocation); - - // Assert - Assert.AreSame(entity, result); + protected override StructuresCalculation CreateDataModel() + { + return new StructuresCalculation(); + } } - [Test] - public void Get_NoHydraulicBoundaryLocationAdded_ThrowsInvalidOperationException() - { - // Setup - var registry = new PersistenceRegistry(); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(5, "6", 7, 8); - - // Call - TestDelegate test = () => registry.Get(hydraulicBoundaryLocation); - - // Assert - Assert.Throws(test); - } - - [Test] - public void Get_OtherHydraulicBoundaryLocationAdded_ThrowsInvalidOperationException() - { - // Setup - var registry = new PersistenceRegistry(); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(5, "6", 7, 8); - registry.Register(new HydraulicLocationEntity(), new HydraulicBoundaryLocation(1, "2", 3, 4)); - - // Call - TestDelegate test = () => registry.Get(hydraulicBoundaryLocation); - - // Assert - Assert.Throws(test); - } - - [Test] - public void Get_WithoutDuneLocation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Get(null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_DuneLocationAdded_ReturnsEntity() - { - // Setup - var registry = new PersistenceRegistry(); - var duneLocation = new TestDuneLocation(); - var entity = new DuneLocationEntity(); - registry.Register(entity, duneLocation); - - // Call - DuneLocationEntity result = registry.Get(duneLocation); - - // Assert - Assert.AreSame(entity, result); - } - - [Test] - public void Get_NoDuneLocationAdded_ThrowsInvalidOperationException() - { - // Setup - var registry = new PersistenceRegistry(); - var duneLocation = new TestDuneLocation(); - - // Call - TestDelegate test = () => registry.Get(duneLocation); - - // Assert - Assert.Throws(test); - } - - [Test] - public void Get_OtherDuneLocationAdded_ThrowsInvalidOperationException() - { - // Setup - var registry = new PersistenceRegistry(); - var duneLocation = new TestDuneLocation(); - registry.Register(new DuneLocationEntity(), new TestDuneLocation()); - - // Call - TestDelegate test = () => registry.Get(duneLocation); - - // Assert - Assert.Throws(test); - } - - [Test] - public void Get_WithoutFailureMechanismSection_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Get((FailureMechanismSection) null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_FailureMechanismSectionAdded_ReturnsEntity() - { - // Setup - var registry = new PersistenceRegistry(); - var section = new TestFailureMechanismSection(); - var entity = new FailureMechanismSectionEntity(); - registry.Register(entity, section); - - // Call - FailureMechanismSectionEntity result = registry.Get(section); - - // Assert - Assert.AreSame(entity, result); - } - - [Test] - public void Get_NoFailureMechanismSectionAdded_ThrowsInvalidOperationException() - { - // Setup - var registry = new PersistenceRegistry(); - var section = new TestFailureMechanismSection(); - - // Call - TestDelegate test = () => registry.Get(section); - - // Assert - Assert.Throws(test); - } - - [Test] - public void Get_OtherFailureMechanismSectionAdded_ThrowsInvalidOperationException() - { - // Setup - var registry = new PersistenceRegistry(); - var section = new TestFailureMechanismSection(); - registry.Register(new FailureMechanismSectionEntity(), new TestFailureMechanismSection()); - - // Call - TestDelegate test = () => registry.Get(section); - - // Assert - Assert.Throws(test); - } - - [Test] - public void Get_WithoutDikeProfile_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get((DikeProfile) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_NoDikeProfileAdded_ThrowsInvalidOperationException() - { - // Setup - DikeProfile dikeProfile = CreateDikeProfile(); - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get(dikeProfile); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_OtherDikeProfileAdded_ThrowsInvalidOperationException() - { - // Setup - DikeProfile dikeProfile = CreateDikeProfile(); - DikeProfile registeredDikeProfile = CreateDikeProfile(); - var registeredEntity = new DikeProfileEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, registeredDikeProfile); - - // Call - TestDelegate call = () => registry.Get(dikeProfile); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_DikeProfileAdded_ReturnsEntity() - { - // Setup - DikeProfile dikeProfile = CreateDikeProfile(); - var registeredEntity = new DikeProfileEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, dikeProfile); - - // Call - DikeProfileEntity retrievedEntity = registry.Get(dikeProfile); - - // Assert - Assert.AreSame(registeredEntity, retrievedEntity); - } - - [Test] - public void Get_WithoutForeshoreProfile_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get((ForeshoreProfile) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_NoForeshoreProfileAdded_ThrowsInvalidOperationException() - { - // Setup - var foreshoreProfile = new TestForeshoreProfile(); - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get(foreshoreProfile); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_OtherForeshoreProfileAdded_ThrowsInvalidOperationException() - { - // Setup - var foreshoreProfile = new TestForeshoreProfile(); - var registeredForeshoreProfile = new TestForeshoreProfile(); - var registeredEntity = new ForeshoreProfileEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, registeredForeshoreProfile); - - // Call - TestDelegate call = () => registry.Get(foreshoreProfile); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_ForeshoreProfileAdded_ReturnsEntity() - { - // Setup - var foreshoreProfile = new TestForeshoreProfile(); - var registeredEntity = new ForeshoreProfileEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, foreshoreProfile); - - // Call - ForeshoreProfileEntity retrievedEntity = registry.Get(foreshoreProfile); - - // Assert - Assert.AreSame(registeredEntity, retrievedEntity); - } - - [Test] - public void Get_WithoutGrassCoverErosionInwardsCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get((GrassCoverErosionInwardsCalculation) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_NoGrassCoverErosionInwardsCalculationAdded_ThrowsInvalidOperationException() - { - // Setup - var calculation = new GrassCoverErosionInwardsCalculation(); - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get(calculation); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_OtherGrassCoverErosionInwardsCalculationAdded_ThrowsInvalidOperationException() - { - // Setup - var calculation = new GrassCoverErosionInwardsCalculation(); - var registeredCalculation = new GrassCoverErosionInwardsCalculation(); - var registeredEntity = new GrassCoverErosionInwardsCalculationEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, registeredCalculation); - - // Call - TestDelegate call = () => registry.Get(calculation); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_GrassCoverErosionInwardsCalculationAdded_ReturnsEntity() - { - // Setup - var calculation = new GrassCoverErosionInwardsCalculation(); - var registeredEntity = new GrassCoverErosionInwardsCalculationEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, calculation); - - // Call - GrassCoverErosionInwardsCalculationEntity retrievedEntity = registry.Get(calculation); - - // Assert - Assert.AreSame(registeredEntity, retrievedEntity); - } - - [Test] - public void Get_WithoutHeightStructure_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get((HeightStructure) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_NoHeightStructureAdded_ThrowsInvalidOperationException() - { - // Setup - HeightStructure heightStructure = new TestHeightStructure(); - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get(heightStructure); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_OtherHeightStructureAdded_ThrowsInvalidOperationException() - { - // Setup - HeightStructure heightStructure = new TestHeightStructure(); - HeightStructure registeredStructure = new TestHeightStructure(); - var registeredEntity = new HeightStructureEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, registeredStructure); - - // Call - TestDelegate call = () => registry.Get(heightStructure); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_HeightStructureAdded_ReturnsEntity() - { - // Setup - HeightStructure heightStructure = new TestHeightStructure(); - var registeredEntity = new HeightStructureEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, heightStructure); - - // Call - HeightStructureEntity retrievedEntity = registry.Get(heightStructure); - - // Assert - Assert.AreSame(registeredEntity, retrievedEntity); - } - - [Test] - public void Get_WithoutStabilityPointStructure_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get((StabilityPointStructure) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_NoStabilityPointStructureAdded_ThrowsInvalidOperationException() - { - // Setup - StabilityPointStructure stabilityPointStructure = new TestStabilityPointStructure(); - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get(stabilityPointStructure); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_OtherStabilityPointStructureAdded_ThrowsInvalidOperationException() - { - // Setup - StabilityPointStructure stabilityPointStructure = new TestStabilityPointStructure(); - StabilityPointStructure registeredStructure = new TestStabilityPointStructure(); - var registeredEntity = new StabilityPointStructureEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, registeredStructure); - - // Call - TestDelegate call = () => registry.Get(stabilityPointStructure); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_StabilityPointStructureAdded_ReturnsEntity() - { - // Setup - StabilityPointStructure stabilityPointStructure = new TestStabilityPointStructure(); - var registeredEntity = new StabilityPointStructureEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, stabilityPointStructure); - - // Call - StabilityPointStructureEntity retrievedEntity = registry.Get(stabilityPointStructure); - - // Assert - Assert.AreSame(registeredEntity, retrievedEntity); - } - - [Test] - public void Get_WithoutHeightStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get((StructuresCalculation) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_NoHeightStructuresCalculationAdded_ThrowsInvalidOperationException() - { - // Setup - var calculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get(calculation); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_OtherHeightStructuresCalculationAdded_ThrowsInvalidOperationException() - { - // Setup - var calculation = new StructuresCalculation(); - var registeredCalculation = new StructuresCalculation(); - var registeredEntity = new HeightStructuresCalculationEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, registeredCalculation); - - // Call - TestDelegate call = () => registry.Get(calculation); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_HeightStructuresCalculationAdded_ReturnsEntity() - { - // Setup - var calculation = new StructuresCalculation(); - var registeredEntity = new HeightStructuresCalculationEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, calculation); - - // Call - HeightStructuresCalculationEntity retrievedEntity = registry.Get(calculation); - - // Assert - Assert.AreSame(registeredEntity, retrievedEntity); - } - - [Test] - public void Get_WithoutClosingStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get((StructuresCalculation) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_NoClosingStructuresCalculationAdded_ThrowsInvalidOperationException() - { - // Setup - var calculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get(calculation); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_OtherClosingStructuresCalculationAdded_ThrowsInvalidOperationException() - { - // Setup - var calculation = new StructuresCalculation(); - var registeredCalculation = new StructuresCalculation(); - var registeredEntity = new ClosingStructuresCalculationEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, registeredCalculation); - - // Call - TestDelegate call = () => registry.Get(calculation); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_ClosingStructuresCalculationAdded_ReturnsEntity() - { - // Setup - var calculation = new StructuresCalculation(); - var registeredEntity = new ClosingStructuresCalculationEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, calculation); - - // Call - ClosingStructuresCalculationEntity retrievedEntity = registry.Get(calculation); - - // Assert - Assert.AreSame(registeredEntity, retrievedEntity); - } - - [Test] - public void Get_WithoutStabilityPointStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get((StructuresCalculation) null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Get_NoStabilityPointStructuresCalculationAdded_ThrowsInvalidOperationException() - { - // Setup - var calculation = new StructuresCalculation(); - var registry = new PersistenceRegistry(); - - // Call - TestDelegate call = () => registry.Get(calculation); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_OtherStabilityPointStructuresCalculationAdded_ThrowsInvalidOperationException() - { - // Setup - var calculation = new StructuresCalculation(); - var registeredCalculation = new StructuresCalculation(); - var registeredEntity = new StabilityPointStructuresCalculationEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, registeredCalculation); - - // Call - TestDelegate call = () => registry.Get(calculation); - - // Assert - Assert.Throws(call); - } - - [Test] - public void Get_StabilityPointStructuresCalculationAdded_ReturnsEntity() - { - // Setup - var calculation = new StructuresCalculation(); - var registeredEntity = new StabilityPointStructuresCalculationEntity(); - - var registry = new PersistenceRegistry(); - registry.Register(registeredEntity, calculation); - - // Call - StabilityPointStructuresCalculationEntity retrievedEntity = registry.Get(calculation); - - // Assert - Assert.AreSame(registeredEntity, retrievedEntity); - } - #endregion - #region Register methods + #region ClosingStructures - [Test] - public void Register_WithNullFailureMechanismSection_ThrowsArgumentNullException() + [TestFixture] + private class ClosingStructureRegistryTest : RegistryTest< + ClosingStructure, ClosingStructureEntity> { - // Setup - var registry = new PersistenceRegistry(); + public ClosingStructureRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - TestDelegate test = () => registry.Register(new FailureMechanismSectionEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); + protected override ClosingStructure CreateDataModel() + { + return new TestClosingStructure(); + } } - [Test] - public void Register_WithNullFailureMechanismSectionEntity_ThrowsArgumentNullException() + [TestFixture] + private class ClosingStructuresCalculationRegistryTest : RegistryTest< + StructuresCalculation, ClosingStructuresCalculationEntity> { - // Setup - var registry = new PersistenceRegistry(); + public ClosingStructuresCalculationRegistryTest() : base( + (r, e, m) => r.Register(e, m), + (r, m) => r.Contains(m), + (r, m) => r.Get(m)) {} - // Call - TestDelegate test = () => registry.Register(null, new TestFailureMechanismSection()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); + protected override StructuresCalculation CreateDataModel() + { + return new StructuresCalculation(); + } } - [Test] - public void Register_WithNullDikeProfile_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new DikeProfileEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullDikeProfileEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, CreateDikeProfile()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullForeshoreProfile_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new ForeshoreProfileEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullForeshoreProfileEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, new TestForeshoreProfile()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullGrassCoverErosionInwardsCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new GrassCoverErosionInwardsCalculationEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullGrassCoverErosionInwardsCalculationEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, new GrassCoverErosionInwardsCalculation()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullHydraulicLocationEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register((HydraulicLocationEntity) null, new HydraulicBoundaryLocation(-1, "name", 0, 0)); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullHydraulicBoundaryLocation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new HydraulicLocationEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullDuneLocationEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, new TestDuneLocation()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullDuneLocation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new DuneLocationEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullHeightStructureEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, new TestHeightStructure()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullHeightStructure_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new HeightStructureEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullStabilityPointStructureEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, new TestStabilityPointStructure()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullStabilityPointStructure_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new StabilityPointStructureEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullHeightStructuresCalculationEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, new TestHeightStructuresCalculation()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullHeightStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new HeightStructuresCalculationEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullClosingStructuresCalculationEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, new TestClosingStructuresCalculation()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullClosingStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new ClosingStructuresCalculationEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - - [Test] - public void Register_WithNullStabilityPointStructuresCalculationEntity_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(null, new TestStabilityPointStructuresCalculation()); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("entity", paramName); - } - - [Test] - public void Register_WithNullStabilityPointStructuresCalculation_ThrowsArgumentNullException() - { - // Setup - var registry = new PersistenceRegistry(); - - // Call - TestDelegate test = () => registry.Register(new StabilityPointStructuresCalculationEntity(), null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("model", paramName); - } - #endregion } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelEntityReadExtensionsTest.cs =================================================================== diff -u -r75239d2d2d30777d12795d21bb0a2c4079009276 -rd9bbfea8e0f8e620379c9b51e427d24560b7cbd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelEntityReadExtensionsTest.cs (.../StochasticSoilModelEntityReadExtensionsTest.cs) (revision 75239d2d2d30777d12795d21bb0a2c4079009276) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelEntityReadExtensionsTest.cs (.../StochasticSoilModelEntityReadExtensionsTest.cs) (revision d9bbfea8e0f8e620379c9b51e427d24560b7cbd4) @@ -82,13 +82,12 @@ } [Test] - public void ReadAsPipingStochasticSoilModel_WithCollector_ReturnsNewStochasticSoilModelWithPropertiesSet() + public void ReadAsPipingStochasticSoilModel_WithMinimumEntity_ReturnsNewStochasticSoilModelWithPropertiesSet() { // Setup - const string testName = "testName"; var entity = new StochasticSoilModelEntity { - Name = testName, + Name = "testName", StochasticSoilModelSegmentPointXml = new Point2DXmlSerializer().ToXml(new Point2D[0]) }; var collector = new ReadConversionCollector(); @@ -98,7 +97,7 @@ // Assert Assert.IsNotNull(model); - Assert.AreEqual(testName, model.Name); + Assert.AreEqual(entity.Name, model.Name); CollectionAssert.IsEmpty(model.Geometry); CollectionAssert.IsEmpty(model.StochasticSoilProfiles); } @@ -145,7 +144,7 @@ PipingStochasticSoilModel model = entity.ReadAsPipingStochasticSoilModel(collector); // Assert - Assert.AreEqual(2, model.StochasticSoilProfiles.Count); + Assert.AreEqual(entity.PipingStochasticSoilProfileEntities.Count, model.StochasticSoilProfiles.Count); CollectionAssert.AreEqual(new[] { "B", @@ -154,7 +153,7 @@ } [Test] - public void ReadAsPipingStochasticSoilModel_WithStochasticSoilModelSegmentPointEntity_ReturnsNewStochasticSoilModelWithGeometryPoints() + public void ReadAsPipingStochasticSoilModel_WithStochasticSoilModelSegmentPointXml_ReturnsNewStochasticSoilModelWithGeometryPoints() { // Setup var segmentPoints = new[] @@ -244,13 +243,12 @@ } [Test] - public void ReadAsMacroStabilityInwardsStochasticSoilModel_WithCollector_ReturnsNewStochasticSoilModelWithPropertiesSet() + public void ReadAsMacroStabilityInwardsStochasticSoilModel_WithMinimumEntity_ReturnsNewStochasticSoilModelWithPropertiesSet() { // Setup - const string testName = "testName"; var entity = new StochasticSoilModelEntity { - Name = testName, + Name = "testName", StochasticSoilModelSegmentPointXml = new Point2DXmlSerializer().ToXml(new Point2D[0]) }; var collector = new ReadConversionCollector(); @@ -260,7 +258,9 @@ // Assert Assert.IsNotNull(model); - Assert.AreEqual(testName, model.Name); + Assert.AreEqual(entity.Name, model.Name); + CollectionAssert.IsEmpty(model.Geometry); + CollectionAssert.IsEmpty(model.StochasticSoilProfiles); } [Test] @@ -305,7 +305,8 @@ MacroStabilityInwardsStochasticSoilModel model = entity.ReadAsMacroStabilityInwardsStochasticSoilModel(collector); // Assert - Assert.AreEqual(2, model.StochasticSoilProfiles.Count); + Assert.AreEqual(entity.MacroStabilityInwardsStochasticSoilProfileEntities.Count, + model.StochasticSoilProfiles.Count); CollectionAssert.AreEqual(new[] { "B", @@ -314,7 +315,7 @@ } [Test] - public void ReadAsMacroStabilityInwardsStochasticSoilModel_WithStochasticSoilModelSegmentPointEntity_ReturnsNewStochasticSoilModelWithGeometryPoints() + public void ReadAsMacroStabilityInwardsStochasticSoilModel_WithStochasticSoilModelSegmentPointXml_ReturnsNewStochasticSoilModelWithGeometryPoints() { // Setup var segmentPoints = new[] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/SurfaceLineEntityReadExtensionsTest.cs =================================================================== diff -u -r1ba21a629ef9ee35b003e5f5e66f26f5b8bc7766 -rd9bbfea8e0f8e620379c9b51e427d24560b7cbd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/SurfaceLineEntityReadExtensionsTest.cs (.../SurfaceLineEntityReadExtensionsTest.cs) (revision 1ba21a629ef9ee35b003e5f5e66f26f5b8bc7766) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/SurfaceLineEntityReadExtensionsTest.cs (.../SurfaceLineEntityReadExtensionsTest.cs) (revision d9bbfea8e0f8e620379c9b51e427d24560b7cbd4) @@ -80,7 +80,7 @@ } [Test] - public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithoutGeometryPointEntities_ReturnSurfaceLine() + public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithoutGeometryPointXml_ReturnSurfaceLine() { // Setup var collector = new ReadConversionCollector(); @@ -113,7 +113,7 @@ } [Test] - public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithGeometryPointEntitiesButNoCharacteristicPoints_ReturnSurfaceLineWithGeometry() + public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithGeometryPointXmlButNoCharacteristicPoints_ReturnSurfaceLineWithGeometry() { // Setup var collector = new ReadConversionCollector(); @@ -153,7 +153,7 @@ } [Test] - public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithGeometryPointEntitiesAndCharacteristicPoints_ReturnFullSurfaceLine() + public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithGeometryPointXmlAndCharacteristicPoints_ReturnFullSurfaceLine() { // Setup var collector = new ReadConversionCollector(); @@ -206,7 +206,7 @@ } [Test] - public void ReadAsPipingSurfaceLine_FullSurfaceLineEntity_ReturnFullSurfaceLine() + public void ReadAsPipingSurfaceLine_SurfaceLineEntityWithPointsAndAllCharacteristicPointsSetToSamePoint_ReturnsExpectedSurfaceLine() { // Setup var collector = new ReadConversionCollector(); @@ -260,27 +260,22 @@ { // Setup var collector = new ReadConversionCollector(); - var random = new Random(31); - var point3D = new Point3D(double.NaN, double.NaN, double.NaN); - var points = new[] - { - point3D, - CreatePoint3D(random) - }; - var entity = new SurfaceLineEntity { Name = "name", - PointsXml = new Point3DXmlSerializer().ToXml(points), + PointsXml = new Point3DXmlSerializer().ToXml(new[] + { + point3D + }), PipingCharacteristicPointEntities = { - CreatePipingCharacteristicPointEntity(points[0], PipingCharacteristicPointType.BottomDitchDikeSide), - CreatePipingCharacteristicPointEntity(points[0], PipingCharacteristicPointType.BottomDitchPolderSide), - CreatePipingCharacteristicPointEntity(points[0], PipingCharacteristicPointType.DikeToeAtPolder), - CreatePipingCharacteristicPointEntity(points[0], PipingCharacteristicPointType.DikeToeAtRiver), - CreatePipingCharacteristicPointEntity(points[0], PipingCharacteristicPointType.DitchDikeSide), - CreatePipingCharacteristicPointEntity(points[0], PipingCharacteristicPointType.DitchPolderSide) + CreatePipingCharacteristicPointEntity(point3D, PipingCharacteristicPointType.BottomDitchDikeSide), + CreatePipingCharacteristicPointEntity(point3D, PipingCharacteristicPointType.BottomDitchPolderSide), + CreatePipingCharacteristicPointEntity(point3D, PipingCharacteristicPointType.DikeToeAtPolder), + CreatePipingCharacteristicPointEntity(point3D, PipingCharacteristicPointType.DikeToeAtRiver), + CreatePipingCharacteristicPointEntity(point3D, PipingCharacteristicPointType.DitchDikeSide), + CreatePipingCharacteristicPointEntity(point3D, PipingCharacteristicPointType.DitchPolderSide) } }; @@ -292,10 +287,7 @@ Assert.IsNaN(surfaceLine.ReferenceLineIntersectionWorldPoint.X); Assert.IsNaN(surfaceLine.ReferenceLineIntersectionWorldPoint.Y); - Point3D[] geometry = surfaceLine.Points.ToArray(); - Assert.AreEqual(2, geometry.Length); - Point3D geometryPoint = geometry[0]; - + Point3D geometryPoint = surfaceLine.Points.Single(); Assert.AreSame(geometryPoint, surfaceLine.BottomDitchDikeSide); Assert.AreSame(geometryPoint, surfaceLine.BottomDitchPolderSide); Assert.AreSame(geometryPoint, surfaceLine.DikeToeAtPolder); @@ -370,7 +362,7 @@ } [Test] - public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithoutGeometryPointEntities_ReturnSurfaceLine() + public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithoutGeometryPointXml_ReturnSurfaceLine() { // Setup var collector = new ReadConversionCollector(); @@ -411,7 +403,7 @@ } [Test] - public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithGeometryPointEntitiesButNoCharacteristicPoints_ReturnSurfaceLineWithGeometry() + public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithGeometryPointXmlButNoCharacteristicPoints_ReturnSurfaceLineWithGeometry() { // Setup var collector = new ReadConversionCollector(); @@ -459,7 +451,7 @@ } [Test] - public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithGeometryPointEntitiesAndCharacteristicPoints_ReturnFullSurfaceLine() + public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithGeometryPointXmlAndCharacteristicPoints_ReturnFullSurfaceLine() { // Setup var collector = new ReadConversionCollector(); @@ -519,7 +511,7 @@ } [Test] - public void ReadAsMacroStabilityInwardsSurfaceLine_FullSurfaceLineEntity_ReturnFullSurfaceLine() + public void ReadAsMacroStabilityInwardsSurfaceLine_SurfaceLineEntityWithPointsAndAllCharacteristicPointsSetToSamePoint_ReturnsExpectedSurfaceLine() { // Setup var collector = new ReadConversionCollector(); @@ -589,35 +581,30 @@ { // Setup var collector = new ReadConversionCollector(); - var random = new Random(31); - var point3D = new Point3D(double.NaN, double.NaN, double.NaN); - var points = new[] - { - point3D, - CreatePoint3D(random) - }; - var entity = new SurfaceLineEntity { Name = "name", - PointsXml = new Point3DXmlSerializer().ToXml(points), + PointsXml = new Point3DXmlSerializer().ToXml(new[] + { + point3D + }), MacroStabilityInwardsCharacteristicPointEntities = { - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.TrafficLoadOutside), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.TrafficLoadInside), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DitchDikeSide), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.DitchPolderSide), - CreateMacroStabilityInwardsCharacteristicPointEntity(points[0], MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside) + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.TrafficLoadOutside), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.TrafficLoadInside), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DitchDikeSide), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.DitchPolderSide), + CreateMacroStabilityInwardsCharacteristicPointEntity(point3D, MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside) } }; @@ -629,10 +616,7 @@ Assert.IsNaN(surfaceLine.ReferenceLineIntersectionWorldPoint.X); Assert.IsNaN(surfaceLine.ReferenceLineIntersectionWorldPoint.Y); - Point3D[] geometry = surfaceLine.Points.ToArray(); - Assert.AreEqual(2, geometry.Length); - Point3D geometryPoint = geometry[0]; - + Point3D geometryPoint = surfaceLine.Points.Single(); Assert.AreSame(geometryPoint, surfaceLine.SurfaceLevelOutside); Assert.AreSame(geometryPoint, surfaceLine.DikeToeAtRiver); Assert.AreSame(geometryPoint, surfaceLine.TrafficLoadOutside); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs =================================================================== diff -u -r1f0cd3fafaa7340a446612870810629587474302 -rd9bbfea8e0f8e620379c9b51e427d24560b7cbd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (.../RingtoetsProjectTestHelperTest.cs) (revision 1f0cd3fafaa7340a446612870810629587474302) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/RingtoetsProjectTestHelperTest.cs (.../RingtoetsProjectTestHelperTest.cs) (revision d9bbfea8e0f8e620379c9b51e427d24560b7cbd4) @@ -157,8 +157,10 @@ Assert.AreEqual(2, soilModel.StochasticSoilProfiles.Count); MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile1 = soilModel.StochasticSoilProfiles[0]; Assert.AreEqual(0.3, stochasticSoilProfile1.Probability); + Assert.IsInstanceOf(stochasticSoilProfile1.SoilProfile); MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile2 = soilModel.StochasticSoilProfiles[1]; Assert.AreEqual(0.7, stochasticSoilProfile2.Probability); + Assert.IsInstanceOf(stochasticSoilProfile2.SoilProfile); Assert.AreEqual("some/path/to/surfaceLineFile", failureMechanism.SurfaceLines.SourcePath); Assert.AreEqual(1, failureMechanism.SurfaceLines.Count); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs =================================================================== diff -u -r8ff26e0d7885f432a6e470e8d68ce325bdc6a9bc -rd9bbfea8e0f8e620379c9b51e427d24560b7cbd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs) (revision 8ff26e0d7885f432a6e470e8d68ce325bdc6a9bc) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs) (revision d9bbfea8e0f8e620379c9b51e427d24560b7cbd4) @@ -28,7 +28,8 @@ namespace Application.Ringtoets.Storage.TestUtil { /// - /// Factory for creating a used for testing. + /// Factory for creating a that can + /// be used for testing. /// public static class MacroStabilityInwardsSoilLayerTwoDEntityTestFactory {