Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs =================================================================== diff -u -ra07b01c421d15a0a1e4933e3967ac1f25d30eccc -r66894d34e58e0db658fa3183df8792ed244ccda3 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs (.../SoilProfileConverterTest.cs) (revision a07b01c421d15a0a1e4933e3967ac1f25d30eccc) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs (.../SoilProfileConverterTest.cs) (revision 66894d34e58e0db658fa3183df8792ed244ccda3) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Core.Common.Base.Data; @@ -55,57 +56,19 @@ // Setup var random = new Random(22); - var soilLayer = new MacroStabilityInwardsSoilLayer2D(CreateRing(21), - new[] - { - CreateRing(11), - CreateRing(22) - }) + MacroStabilityInwardsSoilLayer2D soilLayer1 = CreateRandomSoilLayer(22, new[] { - Data = + CreateRandomSoilLayer(23, Enumerable.Empty()), + CreateRandomSoilLayer(24, Enumerable.Empty()) + }); + + MacroStabilityInwardsSoilLayer2D soilLayer2 = CreateRandomSoilLayer(25, new[] + { + CreateRandomSoilLayer(26, new[] { - UsePop = random.NextBoolean(), - IsAquifer = random.NextBoolean(), - MaterialName = "Test", - AbovePhreaticLevel = - { - Mean = (RoundedDouble) 10, - CoefficientOfVariation = (RoundedDouble) 0.3, - Shift = (RoundedDouble) 0.1 - }, - BelowPhreaticLevel = - { - Mean = (RoundedDouble) 5, - CoefficientOfVariation = (RoundedDouble) 0.8, - Shift = (RoundedDouble) 0.3 - }, - Cohesion = - { - Mean = random.NextRoundedDouble(), - CoefficientOfVariation = random.NextRoundedDouble() - }, - FrictionAngle = - { - Mean = random.NextRoundedDouble(), - CoefficientOfVariation = random.NextRoundedDouble() - }, - StrengthIncreaseExponent = - { - Mean = random.NextRoundedDouble(), - CoefficientOfVariation = random.NextRoundedDouble() - }, - ShearStrengthRatio = - { - Mean = random.NextRoundedDouble(), - CoefficientOfVariation = random.NextRoundedDouble() - }, - Pop = - { - Mean = random.NextRoundedDouble(), - CoefficientOfVariation = random.NextRoundedDouble() - } - } - }; + CreateRandomSoilLayer(27, Enumerable.Empty()) + }) + }); var preconsolidationStress = new MacroStabilityInwardsPreconsolidationStress(new Point2D(random.NextDouble(), random.NextDouble()), new VariationCoefficientLogNormalDistribution @@ -117,7 +80,8 @@ var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine( new[] { - soilLayer + soilLayer1, + soilLayer2 }, new[] { @@ -180,6 +144,63 @@ Assert.AreEqual(expectedShearStrengthModel, soilProfile.Layers.First().ShearStrengthModel); } + private static MacroStabilityInwardsSoilLayer2D CreateRandomSoilLayer(int seed, IEnumerable nestedLayers) + { + return new MacroStabilityInwardsSoilLayer2D(CreateRing(seed), + Enumerable.Empty(), + CreateRandomSoilLayerData(seed), + nestedLayers); + } + + private static MacroStabilityInwardsSoilLayerData CreateRandomSoilLayerData(int seed) + { + var random = new Random(seed); + + return new MacroStabilityInwardsSoilLayerData + { + UsePop = random.NextBoolean(), + IsAquifer = random.NextBoolean(), + MaterialName = "Test", + AbovePhreaticLevel = + { + Mean = random.NextRoundedDouble(1, 10), + CoefficientOfVariation = random.NextRoundedDouble(0, 1), + Shift = random.NextRoundedDouble(0, 1) + }, + BelowPhreaticLevel = + { + Mean = random.NextRoundedDouble(1, 10), + CoefficientOfVariation = random.NextRoundedDouble(0, 1), + Shift = random.NextRoundedDouble(0, 1) + }, + Cohesion = + { + Mean = random.NextRoundedDouble(), + CoefficientOfVariation = random.NextRoundedDouble() + }, + FrictionAngle = + { + Mean = random.NextRoundedDouble(), + CoefficientOfVariation = random.NextRoundedDouble() + }, + StrengthIncreaseExponent = + { + Mean = random.NextRoundedDouble(), + CoefficientOfVariation = random.NextRoundedDouble() + }, + ShearStrengthRatio = + { + Mean = random.NextRoundedDouble(), + CoefficientOfVariation = random.NextRoundedDouble() + }, + Pop = + { + Mean = random.NextRoundedDouble(), + CoefficientOfVariation = random.NextRoundedDouble() + } + }; + } + private static Ring CreateRing(int seed) { var random = new Random(seed);