Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u -ra0e52fbfb95d4930abf6e828fc87e6f4834fb55a -rcf2b4ca40987c1f035b244cc80a382a2bf2cc12b --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensions.cs (.../MacroStabilityInwardsFailureMechanismCreateExtensions.cs) (revision a0e52fbfb95d4930abf6e828fc87e6f4834fb55a) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensions.cs (.../MacroStabilityInwardsFailureMechanismCreateExtensions.cs) (revision cf2b4ca40987c1f035b244cc80a382a2bf2cc12b) @@ -22,7 +22,10 @@ using System; using System.Collections.Generic; using Application.Ringtoets.Storage.DbContext; +using Core.Common.Utils.Extensions; using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Create.MacroStabilityInwards { @@ -38,14 +41,56 @@ /// The object keeping track of create operations. /// A new . /// Thrown when is null. - public static FailureMechanismEntity Create(this MacroStabilityInwardsFailureMechanism mechanism, PersistenceRegistry registry) + public static FailureMechanismEntity Create(this MacroStabilityInwardsFailureMechanism mechanism, + PersistenceRegistry registry) { FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.MacroStabilityInwards, registry); + + AddEntitiesForFailureMechanismMeta(mechanism, entity); + AddEntitiesForStochasticSoilModels(mechanism, registry, entity); + AddEntitiesForSurfaceLines(mechanism, registry, entity); AddEntitiesForSectionResults(mechanism.SectionResults, registry); return entity; } + private static void AddEntitiesForFailureMechanismMeta(MacroStabilityInwardsFailureMechanism mechanism, + FailureMechanismEntity entity) + { + var metaEntity = new MacroStabilityInwardsFailureMechanismMetaEntity + { + A = mechanism.MacroStabilityInwardsProbabilityAssessmentInput.A, + B = mechanism.MacroStabilityInwardsProbabilityAssessmentInput.B, + SectionLength = mechanism.MacroStabilityInwardsProbabilityAssessmentInput.SectionLength.ToNaNAsNull(), + StochasticSoilModelCollectionSourcePath = mechanism.StochasticSoilModels.SourcePath.DeepClone(), + SurfaceLineCollectionSourcePath = mechanism.SurfaceLines.SourcePath.DeepClone() + }; + + entity.MacroStabilityInwardsFailureMechanismMetaEntities.Add(metaEntity); + } + + private static void AddEntitiesForStochasticSoilModels(MacroStabilityInwardsFailureMechanism mechanism, + PersistenceRegistry registry, + FailureMechanismEntity entity) + { + var index = 0; + foreach (MacroStabilityInwardsStochasticSoilModel stochasticSoilModel in mechanism.StochasticSoilModels) + { + entity.StochasticSoilModelEntities.Add(stochasticSoilModel.Create(registry, index++)); + } + } + + private static void AddEntitiesForSurfaceLines(MacroStabilityInwardsFailureMechanism mechanism, + PersistenceRegistry registry, + FailureMechanismEntity entity) + { + var index = 0; + foreach (MacroStabilityInwardsSurfaceLine surfaceLine in mechanism.SurfaceLines) + { + entity.SurfaceLineEntities.Add(surfaceLine.Create(registry, index++)); + } + } + private static void AddEntitiesForSectionResults( IEnumerable sectionResults, PersistenceRegistry registry) Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -rfe90a6d174a01975381e6cda55ed1f7f4e831a51 -rcf2b4ca40987c1f035b244cc80a382a2bf2cc12b --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs (.../MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs) (revision fe90a6d174a01975381e6cda55ed1f7f4e831a51) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs (.../MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs) (revision cf2b4ca40987c1f035b244cc80a382a2bf2cc12b) @@ -25,8 +25,12 @@ using Application.Ringtoets.Storage.Create.MacroStabilityInwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.Base.Geometry; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Test.Create.MacroStabilityInwards { @@ -48,14 +52,13 @@ } [Test] - [TestCase(true)] - [TestCase(false)] - public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet() { // Setup + var random = new Random(31); var failureMechanism = new MacroStabilityInwardsFailureMechanism { - IsRelevant = isRelevant, + IsRelevant = random.NextBoolean(), InputComments = { Body = "Some input text" @@ -77,32 +80,37 @@ // Assert Assert.IsNotNull(entity); Assert.AreEqual((short) FailureMechanismType.MacroStabilityInwards, entity.FailureMechanismType); - Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(Convert.ToByte(failureMechanism.IsRelevant), entity.IsRelevant); Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments); Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments); Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); + + CollectionAssert.IsEmpty(entity.StochasticSoilModelEntities); + MacroStabilityInwardsFailureMechanismMetaEntity failureMechanismMetaEntity = entity.MacroStabilityInwardsFailureMechanismMetaEntities.ToArray()[0]; + Assert.AreEqual(failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.A, failureMechanismMetaEntity.A); + Assert.AreEqual(failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.B, failureMechanismMetaEntity.B); + Assert.IsNull(failureMechanismMetaEntity.SectionLength); + Assert.IsNull(failureMechanismMetaEntity.StochasticSoilModelCollectionSourcePath); + Assert.IsNull(failureMechanismMetaEntity.SurfaceLineCollectionSourcePath); } [Test] public void Create_StringPropertiesDoNotShareReference() { // Setup - const string originalInput = "Some input text"; - const string originalOutput = "Some output text"; - const string originalNotRelevantText = "Really not relevant"; var failureMechanism = new MacroStabilityInwardsFailureMechanism { InputComments = { - Body = originalInput + Body = "Some input text" }, OutputComments = { - Body = originalOutput + Body = "Some output text" }, NotRelevantComments = { - Body = originalNotRelevantText + Body = "Really not relevant" } }; var registry = new PersistenceRegistry(); @@ -111,18 +119,120 @@ FailureMechanismEntity entity = failureMechanism.Create(registry); // Assert - Assert.AreNotSame(originalInput, entity.InputComments, - "To create stable binary representations/fingerprints, it's really important that strings are not shared."); - Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments); - Assert.AreNotSame(originalOutput, entity.OutputComments, - "To create stable binary representations/fingerprints, it's really important that strings are not shared."); - Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments); - Assert.AreNotSame(originalNotRelevantText, entity.NotRelevantComments, - "To create stable binary representations/fingerprints, it's really important that strings are not shared."); - Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); + TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments); + TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments); + TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); } [Test] + public void Create_WithStochasticSoilModels_ReturnsFailureMechanismEntityWithStochasticSoilModelEntities() + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + MacroStabilityInwardsStochasticSoilModelCollection stochasticSoilModels = failureMechanism.StochasticSoilModels; + + stochasticSoilModels.AddRange(new[] + { + new MacroStabilityInwardsStochasticSoilModel("name"), + new MacroStabilityInwardsStochasticSoilModel("name2") + }, "some/path/to/file"); + + var registry = new PersistenceRegistry(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(2, entity.StochasticSoilModelEntities.Count); + for (var i = 0; i < stochasticSoilModels.Count; i++) + { + AssertStochasticSoilModel(stochasticSoilModels.ElementAt(i), + entity.StochasticSoilModelEntities.ElementAt(i)); + } + + Assert.AreEqual(1, entity.MacroStabilityInwardsFailureMechanismMetaEntities.Count); + string stochasticSoilModelCollectionSourcePath = entity.MacroStabilityInwardsFailureMechanismMetaEntities + .Single() + .StochasticSoilModelCollectionSourcePath; + TestHelper.AssertAreEqualButNotSame(stochasticSoilModels.SourcePath, stochasticSoilModelCollectionSourcePath); + } + + [Test] + public void Create_WithSurfaceLines_ReturnFailureMechanismEntityWithSurfaceLineEntities() + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism(); + MacroStabilityInwardsSurfaceLineCollection failureMechanismSurfaceLines = failureMechanism.SurfaceLines; + + failureMechanismSurfaceLines.AddRange(new[] + { + CreateSurfaceLine(new Random(31)) + }, "path"); + + var registry = new PersistenceRegistry(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(failureMechanismSurfaceLines.Count, entity.SurfaceLineEntities.Count); + for (var i = 0; i < failureMechanismSurfaceLines.Count; i++) + { + AssertSurfaceLine(failureMechanismSurfaceLines.ElementAt(i), entity.SurfaceLineEntities.ElementAt(i)); + } + + string surfaceLineCollectionSourcePath = entity.MacroStabilityInwardsFailureMechanismMetaEntities + .Single() + .SurfaceLineCollectionSourcePath; + TestHelper.AssertAreEqualButNotSame(failureMechanismSurfaceLines.SourcePath, surfaceLineCollectionSourcePath); + } + + private static void AssertSurfaceLine(MacroStabilityInwardsSurfaceLine surfaceLine, SurfaceLineEntity entity) + { + Assert.AreEqual(surfaceLine.Name, entity.Name); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY); + + Assert.AreEqual(0, entity.PipingCharacteristicPointEntities.Count); + Assert.AreEqual(14, entity.MacroStabilityInwardsCharacteristicPointEntities.Count); + } + + private MacroStabilityInwardsSurfaceLine CreateSurfaceLine(Random random) + { + var surfaceLine = new MacroStabilityInwardsSurfaceLine(nameof(MacroStabilityInwardsSurfaceLine)) + { + ReferenceLineIntersectionWorldPoint = new Point2D(random.NextDouble(), random.NextDouble()) + }; + + var geometryPoints = new Point3D[14]; + for (var i = 0; i < geometryPoints.Length; i++) + { + geometryPoints[i] = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()); + } + surfaceLine.SetGeometry(geometryPoints); + + surfaceLine.SetDitchPolderSideAt(geometryPoints[1]); + surfaceLine.SetBottomDitchPolderSideAt(geometryPoints[2]); + surfaceLine.SetBottomDitchDikeSideAt(geometryPoints[3]); + surfaceLine.SetDitchDikeSideAt(geometryPoints[4]); + surfaceLine.SetDikeTopAtPolderAt(geometryPoints[5]); + surfaceLine.SetDikeTopAtRiverAt(geometryPoints[6]); + surfaceLine.SetShoulderBaseInsideAt(geometryPoints[7]); + surfaceLine.SetShoulderTopInsideAt(geometryPoints[8]); + surfaceLine.SetTrafficLoadInsideAt(geometryPoints[9]); + surfaceLine.SetTrafficLoadOutsideAt(geometryPoints[10]); + surfaceLine.SetDikeToeAtRiverAt(geometryPoints[11]); + surfaceLine.SetDikeToeAtPolderAt(geometryPoints[12]); + surfaceLine.SetSurfaceLevelInsideAt(geometryPoints[13]); + surfaceLine.SetSurfaceLevelOutsideAt(geometryPoints[0]); + + return surfaceLine; + } + + + [Test] public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() { // Setup @@ -149,5 +259,11 @@ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacroStabilityInwardsSectionResultEntities).Count()); } + + private static void AssertStochasticSoilModel(MacroStabilityInwardsStochasticSoilModel model, StochasticSoilModelEntity entity) + { + Assert.AreEqual(model.Name, entity.Name); + Assert.AreEqual(model.StochasticSoilProfiles.Count, entity.MacroStabilityInwardsStochasticSoilProfileEntities.Count); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs =================================================================== diff -u -r268d5940d8ed4a65319179de7515eaf89586ad0a -rcf2b4ca40987c1f035b244cc80a382a2bf2cc12b --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision 268d5940d8ed4a65319179de7515eaf89586ad0a) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision cf2b4ca40987c1f035b244cc80a382a2bf2cc12b) @@ -378,6 +378,7 @@ /// model is registered in the registry. /// The action to perform to get the data model from /// the registry. + /// Thrown when any input parameter is null. /// public DerivedRegistryTest() : base( /// (r, e, m) => r.Register(e, m), /// (r, m) => r.Contains(m), @@ -386,6 +387,19 @@ Func containsInRegistry, Func getFromRegistry) { + if (registerToRegistry == null) + { + throw new ArgumentNullException(nameof(registerToRegistry)); + } + if (containsInRegistry == null) + { + throw new ArgumentNullException(nameof(containsInRegistry)); + } + if (getFromRegistry == null) + { + throw new ArgumentNullException(nameof(getFromRegistry)); + } + this.registerToRegistry = registerToRegistry; this.containsInRegistry = containsInRegistry; this.getFromRegistry = getFromRegistry; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -r99f686f22091051a65ff1ee20abd68ffad713647 -rcf2b4ca40987c1f035b244cc80a382a2bf2cc12b --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismCreateExtensionsTest.cs (.../PipingFailureMechanismCreateExtensionsTest.cs) (revision 99f686f22091051a65ff1ee20abd68ffad713647) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismCreateExtensionsTest.cs (.../PipingFailureMechanismCreateExtensionsTest.cs) (revision cf2b4ca40987c1f035b244cc80a382a2bf2cc12b) @@ -27,6 +27,7 @@ using Application.Ringtoets.Storage.TestUtil; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; using Ringtoets.Piping.Data; @@ -53,14 +54,13 @@ } [Test] - [TestCase(true)] - [TestCase(false)] - public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet() { // Setup + var random = new Random(31); var failureMechanism = new PipingFailureMechanism { - IsRelevant = isRelevant, + IsRelevant = random.NextBoolean(), InputComments = { Body = "Some input text" @@ -90,7 +90,7 @@ // Assert Assert.IsNotNull(entity); Assert.AreEqual((short) FailureMechanismType.Piping, entity.FailureMechanismType); - Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(Convert.ToByte(failureMechanism.IsRelevant), entity.IsRelevant); Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments); Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments); Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); @@ -107,22 +107,19 @@ public void Create_StringPropertiesDoNotShareReference() { // Setup - const string originalInput = "Some input text"; - const string originalOutput = "Some output text"; - const string originalNotRelevantText = "Really not relevant"; var failureMechanism = new PipingFailureMechanism { InputComments = { - Body = originalInput + Body = "Some input text" }, OutputComments = { - Body = originalOutput + Body = "Some output text" }, NotRelevantComments = { - Body = originalNotRelevantText + Body = "Really not relevant" } }; var registry = new PersistenceRegistry(); @@ -131,28 +128,23 @@ FailureMechanismEntity entity = failureMechanism.Create(registry); // Assert - Assert.AreNotSame(originalInput, entity.InputComments, - "To create stable binary representations/fingerprints, it's really important that strings are not shared."); - Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments); - Assert.AreNotSame(originalOutput, entity.OutputComments, - "To create stable binary representations/fingerprints, it's really important that strings are not shared."); - Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments); - Assert.AreNotSame(originalNotRelevantText, entity.NotRelevantComments, - "To create stable binary representations/fingerprints, it's really important that strings are not shared."); - Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); + TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments); + TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments); + TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); } [Test] public void Create_WithStochasticSoilModels_ReturnsFailureMechanismEntityWithStochasticSoilModelEntities() { // Setup var failureMechanism = new PipingFailureMechanism(); - const string somePath = "some/path/to/file"; - failureMechanism.StochasticSoilModels.AddRange(new[] + PipingStochasticSoilModelCollection stochasticSoilModels = failureMechanism.StochasticSoilModels; + + stochasticSoilModels.AddRange(new[] { new PipingStochasticSoilModel("name"), new PipingStochasticSoilModel("name2") - }, somePath); + }, "some/path/to/file"); var registry = new PersistenceRegistry(); @@ -162,13 +154,17 @@ // Assert Assert.IsNotNull(entity); Assert.AreEqual(2, entity.StochasticSoilModelEntities.Count); - Assert.AreEqual(1, entity.PipingFailureMechanismMetaEntities.Count); + for (var i = 0; i < stochasticSoilModels.Count; i++) + { + AssertStochasticSoilModel(stochasticSoilModels.ElementAt(i), + entity.StochasticSoilModelEntities.ElementAt(i)); + } + Assert.AreEqual(1, entity.PipingFailureMechanismMetaEntities.Count); string stochasticSoilModelCollectionSourcePath = entity.PipingFailureMechanismMetaEntities .Single() .StochasticSoilModelCollectionSourcePath; - Assert.AreNotSame(somePath, stochasticSoilModelCollectionSourcePath); - Assert.AreEqual(somePath, stochasticSoilModelCollectionSourcePath); + TestHelper.AssertAreEqualButNotSame(stochasticSoilModels.SourcePath, stochasticSoilModelCollectionSourcePath); } [Test] @@ -193,13 +189,13 @@ public void Create_WithSurfaceLines_ReturnFailureMechanismEntityWithSurfaceLineEntities() { // Setup - var random = new Random(); var failureMechanism = new PipingFailureMechanism(); - const string somePath = "path"; - failureMechanism.SurfaceLines.AddRange(new[] + PipingSurfaceLineCollection failureMechanismSurfaceLines = failureMechanism.SurfaceLines; + + failureMechanismSurfaceLines.AddRange(new[] { - CreateSurfaceLine(random) - }, somePath); + CreateSurfaceLine(new Random(31)) + }, "path"); var registry = new PersistenceRegistry(); @@ -208,13 +204,16 @@ // Assert Assert.IsNotNull(entity); - Assert.AreEqual(failureMechanism.SurfaceLines.Count, entity.SurfaceLineEntities.Count); + Assert.AreEqual(failureMechanismSurfaceLines.Count, entity.SurfaceLineEntities.Count); + for (var i = 0; i < failureMechanismSurfaceLines.Count; i++) + { + AssertSurfaceLine(failureMechanismSurfaceLines.ElementAt(i), entity.SurfaceLineEntities.ElementAt(i)); + } string surfaceLineCollectionSourcePath = entity.PipingFailureMechanismMetaEntities .Single() .SurfaceLineCollectionSourcePath; - Assert.AreNotSame(somePath, surfaceLineCollectionSourcePath); - Assert.AreEqual(somePath, surfaceLineCollectionSourcePath); + TestHelper.AssertAreEqualButNotSame(failureMechanismSurfaceLines.SourcePath, surfaceLineCollectionSourcePath); } [Test] @@ -245,9 +244,26 @@ Assert.AreEqual(1, childGroupEntities[1].Order); } + private static void AssertSurfaceLine(PipingSurfaceLine surfaceLine, SurfaceLineEntity entity) + { + Assert.AreEqual(surfaceLine.Name, entity.Name); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY); + + Assert.AreEqual(6, entity.PipingCharacteristicPointEntities.Count); + Assert.AreEqual(0, entity.MacroStabilityInwardsCharacteristicPointEntities.Count); + } + + private static void AssertStochasticSoilModel(PipingStochasticSoilModel model, StochasticSoilModelEntity entity) + { + Assert.AreEqual(model.Name, entity.Name); + Assert.AreEqual(model.StochasticSoilProfiles.Count, entity.PipingStochasticSoilProfileEntities.Count); + Assert.AreEqual(0, entity.MacroStabilityInwardsStochasticSoilProfileEntities.Count); + } + private PipingSurfaceLine CreateSurfaceLine(Random random) { - var surfaceLine = new PipingSurfaceLine("A") + var surfaceLine = new PipingSurfaceLine(nameof(PipingSurfaceLine)) { ReferenceLineIntersectionWorldPoint = new Point2D(random.NextDouble(), random.NextDouble()) };