Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsPreconsolidationStressTestFactoryTest.cs =================================================================== diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -r237eeb7ad9bc674a96a7565f0eb6ec9333f422c8 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsPreconsolidationStressTestFactoryTest.cs (.../MacroStabilityInwardsPreconsolidationStressTestFactoryTest.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsPreconsolidationStressTestFactoryTest.cs (.../MacroStabilityInwardsPreconsolidationStressTestFactoryTest.cs) (revision 237eeb7ad9bc674a96a7565f0eb6ec9333f422c8) @@ -39,12 +39,29 @@ MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress(); // Assert - Assert.IsNotNull(stress); Assert.AreEqual(new Point2D(13, 34), stress.Location); VariationCoefficientLogNormalDistribution stressDistribution = stress.Stress; Assert.AreEqual(10.09, stressDistribution.Mean, stressDistribution.GetAccuracy()); Assert.AreEqual(20.05, stressDistribution.CoefficientOfVariation, stressDistribution.GetAccuracy()); } + + [Test] + public void CreateMacroStabilityInwardsPreconsolidationStress_WithLocation_ReturnsExpectedValues() + { + // Setup + var location = new Point2D(0, 0); + + // Call + MacroStabilityInwardsPreconsolidationStress stress = + MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress(location); + + // Assert + Assert.AreSame(location, stress.Location); + + VariationCoefficientLogNormalDistribution stressDistribution = stress.Stress; + Assert.AreEqual(10.09, stressDistribution.Mean, stressDistribution.GetAccuracy()); + Assert.AreEqual(20.05, stressDistribution.CoefficientOfVariation, stressDistribution.GetAccuracy()); + } } } \ No newline at end of file Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTestFactoryTest.cs =================================================================== diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -r237eeb7ad9bc674a96a7565f0eb6ec9333f422c8 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTestFactoryTest.cs (.../MacroStabilityInwardsStochasticSoilProfileTestFactoryTest.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTestFactoryTest.cs (.../MacroStabilityInwardsStochasticSoilProfileTestFactoryTest.cs) (revision 237eeb7ad9bc674a96a7565f0eb6ec9333f422c8) @@ -44,7 +44,9 @@ new Ring(new List { new Point2D(4.0, 2.0), - new Point2D(0.0, 2.5) + new Point2D(0.0, 2.5), + new Point2D(4.0, 2.5), + new Point2D(4.0, 3.0) }), new MacroStabilityInwardsSoilLayerData { @@ -56,7 +58,9 @@ new Ring(new List { new Point2D(4.0, 2.0), - new Point2D(0.0, 2.5) + new Point2D(0.0, 2.5), + new Point2D(4.0, 2.5), + new Point2D(4.0, 3.0) }), new MacroStabilityInwardsSoilLayerData { @@ -73,22 +77,26 @@ new Ring(new List { new Point2D(0.0, 1.0), - new Point2D(2.0, 4.0) + new Point2D(2.0, 4.0), + new Point2D(2.0, 1.0), + new Point2D(0.0, 0.0) }), new MacroStabilityInwardsSoilLayerData { - MaterialName = "Sand" + MaterialName = "Sand1" }, Enumerable.Empty()), new MacroStabilityInwardsSoilLayer2D( new Ring(new List { new Point2D(3.0, 1.0), - new Point2D(8.0, 3.0) + new Point2D(3.0, 3.0), + new Point2D(8.0, 3.0), + new Point2D(8.0, 1.0) }), new MacroStabilityInwardsSoilLayerData { - MaterialName = "Sand" + MaterialName = "Sand2" }, new[] { @@ -99,11 +107,13 @@ new Ring(new List { new Point2D(2.0, 4.0), - new Point2D(2.0, 8.0) + new Point2D(2.0, 8.0), + new Point2D(4.0, 8.0), + new Point2D(4.0, 4.0) }), new MacroStabilityInwardsSoilLayerData { - MaterialName = "Sand" + MaterialName = "Sand3" }, Enumerable.Empty()) }; @@ -115,5 +125,105 @@ CollectionAssert.AreEqual(layers, soilProfile.Layers); CollectionAssert.IsEmpty(soilProfile.PreconsolidationStresses); } + + [Test] + public void CreateMacroStabilityInwardsStochasticSoilProfile2D_WithPreconsolidationStresses_ReturnsExpectedMacroStabilityInwardsStochasticSoilProfile2D() + { + // Setup + MacroStabilityInwardsPreconsolidationStress[] preconsolidationStresses = + { + MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress() + }; + + // Call + MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile = MacroStabilityInwardsStochasticSoilProfileTestFactory + .CreateMacroStabilityInwardsStochasticSoilProfile2D(preconsolidationStresses); + + // Assert + var doubleNestedLayer = new MacroStabilityInwardsSoilLayer2D( + new Ring(new List + { + new Point2D(4.0, 2.0), + new Point2D(0.0, 2.5), + new Point2D(4.0, 2.5), + new Point2D(4.0, 3.0) + }), + new MacroStabilityInwardsSoilLayerData + { + MaterialName = "Soil" + }, + Enumerable.Empty()); + + var nestedLayer = new MacroStabilityInwardsSoilLayer2D( + new Ring(new List + { + new Point2D(4.0, 2.0), + new Point2D(0.0, 2.5), + new Point2D(4.0, 2.5), + new Point2D(4.0, 3.0) + }), + new MacroStabilityInwardsSoilLayerData + { + MaterialName = "Clay" + }, + new[] + { + doubleNestedLayer + }); + + var layers = new[] + { + new MacroStabilityInwardsSoilLayer2D( + new Ring(new List + { + new Point2D(0.0, 1.0), + new Point2D(2.0, 4.0), + new Point2D(2.0, 1.0), + new Point2D(0.0, 0.0) + }), + new MacroStabilityInwardsSoilLayerData + { + MaterialName = "Sand1" + }, + Enumerable.Empty()), + new MacroStabilityInwardsSoilLayer2D( + new Ring(new List + { + new Point2D(3.0, 1.0), + new Point2D(3.0, 3.0), + new Point2D(8.0, 3.0), + new Point2D(8.0, 1.0) + }), + new MacroStabilityInwardsSoilLayerData + { + MaterialName = "Sand2" + }, + new[] + { + nestedLayer + } + ), + new MacroStabilityInwardsSoilLayer2D( + new Ring(new List + { + new Point2D(2.0, 4.0), + new Point2D(2.0, 8.0), + new Point2D(4.0, 8.0), + new Point2D(4.0, 4.0) + }), + new MacroStabilityInwardsSoilLayerData + { + MaterialName = "Sand3" + }, + Enumerable.Empty()) + }; + + Assert.AreEqual(0.5, stochasticSoilProfile.Probability); + + var soilProfile = (MacroStabilityInwardsSoilProfile2D) stochasticSoilProfile.SoilProfile; + Assert.AreEqual("Profile 2D", soilProfile.Name); + CollectionAssert.AreEqual(layers, soilProfile.Layers); + CollectionAssert.AreEqual(preconsolidationStresses, soilProfile.PreconsolidationStresses); + } } } \ No newline at end of file Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsPreconsolidationStressTestFactory.cs =================================================================== diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -r237eeb7ad9bc674a96a7565f0eb6ec9333f422c8 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsPreconsolidationStressTestFactory.cs (.../MacroStabilityInwardsPreconsolidationStressTestFactory.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsPreconsolidationStressTestFactory.cs (.../MacroStabilityInwardsPreconsolidationStressTestFactory.cs) (revision 237eeb7ad9bc674a96a7565f0eb6ec9333f422c8) @@ -38,12 +38,24 @@ /// The created . public static MacroStabilityInwardsPreconsolidationStress CreateMacroStabilityInwardsPreconsolidationStress() { - return new MacroStabilityInwardsPreconsolidationStress(new Point2D(13, 34), + return CreateMacroStabilityInwardsPreconsolidationStress(new Point2D(13, 34)); + } + + /// + /// Creates a new instance of . + /// + /// The location of the preconsolidation stress. + /// The created . + public static MacroStabilityInwardsPreconsolidationStress CreateMacroStabilityInwardsPreconsolidationStress(Point2D location) + { + return new MacroStabilityInwardsPreconsolidationStress(location, new VariationCoefficientLogNormalDistribution { Mean = (RoundedDouble) 10.09, CoefficientOfVariation = (RoundedDouble) 20.05 }); } + + } } \ No newline at end of file Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTestFactory.cs =================================================================== diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -r237eeb7ad9bc674a96a7565f0eb6ec9333f422c8 --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTestFactory.cs (.../MacroStabilityInwardsStochasticSoilProfileTestFactory.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTestFactory.cs (.../MacroStabilityInwardsStochasticSoilProfileTestFactory.cs) (revision 237eeb7ad9bc674a96a7565f0eb6ec9333f422c8) @@ -40,11 +40,24 @@ /// A configured . public static MacroStabilityInwardsStochasticSoilProfile CreateMacroStabilityInwardsStochasticSoilProfile2D() { + return CreateMacroStabilityInwardsStochasticSoilProfile2D(Enumerable.Empty()); + } + + /// + /// Creates a new instance of with + /// a configured 2D soil profile. + /// + /// The preconsolidation stresses that are part of the profile. + /// A configured . + public static MacroStabilityInwardsStochasticSoilProfile CreateMacroStabilityInwardsStochasticSoilProfile2D(IEnumerable preconsolidationStresses) + { var doubleNestedLayer = new MacroStabilityInwardsSoilLayer2D( new Ring(new List { new Point2D(4.0, 2.0), - new Point2D(0.0, 2.5) + new Point2D(0.0, 2.5), + new Point2D(4.0, 2.5), + new Point2D(4.0, 3.0) }), new MacroStabilityInwardsSoilLayerData { @@ -56,7 +69,9 @@ new Ring(new List { new Point2D(4.0, 2.0), - new Point2D(0.0, 2.5) + new Point2D(0.0, 2.5), + new Point2D(4.0, 2.5), + new Point2D(4.0, 3.0) }), new MacroStabilityInwardsSoilLayerData { @@ -73,22 +88,27 @@ new Ring(new List { new Point2D(0.0, 1.0), - new Point2D(2.0, 4.0) + new Point2D(2.0, 4.0), + new Point2D(2.0, 1.0), + new Point2D(0.0, 0.0) + }), new MacroStabilityInwardsSoilLayerData { - MaterialName = "Sand" + MaterialName = "Sand1" }, Enumerable.Empty()), new MacroStabilityInwardsSoilLayer2D( new Ring(new List { new Point2D(3.0, 1.0), - new Point2D(8.0, 3.0) + new Point2D(3.0, 3.0), + new Point2D(8.0, 3.0), + new Point2D(8.0, 1.0) }), new MacroStabilityInwardsSoilLayerData { - MaterialName = "Sand" + MaterialName = "Sand2" }, new[] { @@ -99,20 +119,19 @@ new Ring(new List { new Point2D(2.0, 4.0), - new Point2D(2.0, 8.0) + new Point2D(2.0, 8.0), + new Point2D(4.0, 8.0), + new Point2D(4.0, 4.0) }), new MacroStabilityInwardsSoilLayerData { - MaterialName = "Sand" + MaterialName = "Sand3" }, Enumerable.Empty()) }; - return new MacroStabilityInwardsStochasticSoilProfile(0.5, - new MacroStabilityInwardsSoilProfile2D( - "Profile 2D", - layers, - Enumerable.Empty())); + return new MacroStabilityInwardsStochasticSoilProfile( + 0.5, new MacroStabilityInwardsSoilProfile2D("Profile 2D", layers, preconsolidationStresses)); } } } \ No newline at end of file