Index: Core/Common/src/Core.Common.Geometry/AdvancedMath2D.cs =================================================================== diff -u -r58bcdff0e0effb884294342067cc723e06961379 -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Core/Common/src/Core.Common.Geometry/AdvancedMath2D.cs (.../AdvancedMath2D.cs) (revision 58bcdff0e0effb884294342067cc723e06961379) +++ Core/Common/src/Core.Common.Geometry/AdvancedMath2D.cs (.../AdvancedMath2D.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -65,7 +65,7 @@ /// /// The line to complete. /// The level at which to place the points completing the polygon. - /// A new collection of , with the line's point and + /// A new collection of , with the line's points and /// the two new bottom points. /// Thrown when is null. /// Index: Core/Common/test/Core.Common.Geometry.Test/AdvancedMath2DTest.cs =================================================================== diff -u -rfe90a6d174a01975381e6cda55ed1f7f4e831a51 -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Core/Common/test/Core.Common.Geometry.Test/AdvancedMath2DTest.cs (.../AdvancedMath2DTest.cs) (revision fe90a6d174a01975381e6cda55ed1f7f4e831a51) +++ Core/Common/test/Core.Common.Geometry.Test/AdvancedMath2DTest.cs (.../AdvancedMath2DTest.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -388,7 +388,7 @@ } [Test] - public void CompleteLineToPolygon_LineWithLessThanTwoPoints_ThrowsArgumentNullException([Range(0,1)] int pointCount) + public void CompleteLineToPolygon_LineWithLessThanTwoPoints_ThrowsArgumentNullException([Range(0, 1)] int pointCount) { // Setup IEnumerable points = Enumerable.Repeat(new Point2D(3, 2), pointCount); @@ -402,7 +402,6 @@ Assert.AreEqual("line", exception.ParamName); } - [Test] [TestCase(3)] [TestCase(0)] @@ -414,19 +413,20 @@ var random = new Random(21); int firstPointX = random.Next(); int lastPointX = random.Next(); - var points = new [] + var points = new[] { - new Point2D(firstPointX, random.Next()), - new Point2D(random.Next(), random.Next()), - new Point2D(lastPointX, random.Next()), + new Point2D(firstPointX, random.Next()), + new Point2D(random.Next(), random.Next()), + new Point2D(lastPointX, random.Next()) }; - + // Call Point2D[] pointsOfPolygon = AdvancedMath2D.CompleteLineToPolygon(points, completingPointsLevel).ToArray(); // Assert - Assert.AreEqual(new Point2D(lastPointX, completingPointsLevel), pointsOfPolygon.ElementAt(3)); - Assert.AreEqual(new Point2D(firstPointX, completingPointsLevel), pointsOfPolygon.ElementAt(4)); + Assert.AreEqual(points, pointsOfPolygon.Take(3)); + Assert.AreEqual(new Point2D(lastPointX, completingPointsLevel), pointsOfPolygon[3]); + Assert.AreEqual(new Point2D(firstPointX, completingPointsLevel), pointsOfPolygon[4]); } private static double[] ThreeRandomXCoordinates() Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -1116,26 +1116,8 @@ [Test] public void AssertCollectionsAreEqual_ComparerNull_ThrowsException() { - // Setup - var objectA = new object(); - var objectB = new object(); - var objectC = new object(); - var objectD = new object(); - // Call - TestDelegate test = () => TestHelper.AssertCollectionsAreEqual(new[] - { - objectA, - objectB, - objectC, - objectD - }, new[] - { - objectA, - objectB, - objectC, - objectD - }, null); + TestDelegate test = () => TestHelper.AssertCollectionsAreEqual(Enumerable.Empty(), Enumerable.Empty(), null); // Assert Assert.Throws(test); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilLayerUnderSurfaceLine.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilLayerUnderSurfaceLine.cs (.../SoilLayerUnderSurfaceLine.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilLayerUnderSurfaceLine.cs (.../SoilLayerUnderSurfaceLine.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -37,6 +37,7 @@ /// /// The outer ring of the geometry of the soil layer. /// The properties of the soil layer. + /// Thrown when any parameter is null. public SoilLayerUnderSurfaceLine(Point2D[] outerRing, SoilLayerProperties properties) : this(outerRing, Enumerable.Empty(), properties) {} @@ -46,6 +47,7 @@ /// The outer ring of the geometry of the soil layer. /// The holes of the geometry of the soil layer. /// The properties of the soil layer. + /// Thrown when any parameter is null. public SoilLayerUnderSurfaceLine(Point2D[] outerRing, IEnumerable holes, SoilLayerProperties properties) { if (outerRing == null) Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLine.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLine.cs (.../SoilProfileUnderSurfaceLine.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfileUnderSurfaceLine.cs (.../SoilProfileUnderSurfaceLine.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -25,14 +25,16 @@ namespace Ringtoets.MacroStabilityInwards.Data { /// - /// A soil profile for which it's soil layers have been adapted using a surface line. + /// A soil profile for which its soil layers have been adapted using a surface line. /// public class SoilProfileUnderSurfaceLine { /// /// Creates a new instance of . /// /// The layers in the profile. + /// Thrown when + /// is null. public SoilProfileUnderSurfaceLine(IEnumerable layersUnderSurfaceLine) { if (layersUnderSurfaceLine == null) Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs =================================================================== diff -u -r11770f197071c45397a34ec91fc3981acf05c850 -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs (.../SoilLayerProperties.cs) (revision 11770f197071c45397a34ec91fc3981acf05c850) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/SoilLayerProperties.cs (.../SoilLayerProperties.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -67,7 +67,7 @@ public bool UsePop { get; set; } /// - /// Gets or sets the shear strenth model to use for the layer. + /// Gets or sets the shear strength model to use for the layer. /// public ShearStrengthModel ShearStrengthModel { get; set; } @@ -96,91 +96,91 @@ public double BelowPhreaticLevelDeviation { get; set; } = double.NaN; /// - /// Gets or sets the mean of the distribution for the cohesion of the + /// Gets or sets the mean of the distribution for the cohesion. /// [kN/m³] /// public double CohesionMean { get; set; } = double.NaN; /// - /// Gets or sets the deviation of the distribution for the cohesion of the . + /// Gets or sets the deviation of the distribution for the cohesion. /// [kN/m³] /// public double CohesionDeviation { get; set; } = double.NaN; /// - /// Gets or sets the shift of the distribution for the cohesion of the . + /// Gets or sets the shift of the distribution for the cohesion. /// [kN/m³] /// public double CohesionShift { get; set; } = double.NaN; /// - /// Gets or sets the mean of the distribution for the friction angle of the + /// Gets or sets the mean of the distribution for the friction angle /// [°] /// public double FrictionAngleMean { get; set; } = double.NaN; /// - /// Gets or sets the deviation of the distribution for the friction angle of the . + /// Gets or sets the deviation of the distribution for the friction angle. /// [°] /// public double FrictionAngleDeviation { get; set; } = double.NaN; /// - /// Gets or sets the shift of the distribution for the friction angle of the . + /// Gets or sets the shift of the distribution for the friction angle. /// [°] /// public double FrictionAngleShift { get; set; } = double.NaN; /// - /// Gets or sets the mean of the distribution for the ratio of shear strength S of the + /// Gets or sets the mean of the distribution for the ratio of shear strength S /// [-] /// public double ShearStrengthRatioMean { get; set; } = double.NaN; /// - /// Gets or sets the deviation of the distribution for the ratio of shear strength S of the . + /// Gets or sets the deviation of the distribution for the ratio of shear strength S. /// [-] /// public double ShearStrengthRatioDeviation { get; set; } = double.NaN; /// - /// Gets or sets the shift of the distribution for the ratio of shear strength S of the . + /// Gets or sets the shift of the distribution for the ratio of shear strength S. /// [-] /// public double ShearStrengthRatioShift { get; set; } = double.NaN; /// - /// Gets or sets the mean of the distribution for the strength increase exponent (m) of the + /// Gets or sets the mean of the distribution for the strength increase exponent (m) /// [-] /// public double StrengthIncreaseExponentMean { get; set; } = double.NaN; /// - /// Gets or sets the deviation of the distribution for the strength increase exponent (m) of the . + /// Gets or sets the deviation of the distribution for the strength increase exponent (m). /// [-] /// public double StrengthIncreaseExponentDeviation { get; set; } = double.NaN; /// - /// Gets or sets the shift of the distribution for the strength increase exponent (m) of the . + /// Gets or sets the shift of the distribution for the strength increase exponent (m). /// [-] /// public double StrengthIncreaseExponentShift { get; set; } = double.NaN; /// - /// Gets or sets the mean of the distribution for the POP of the + /// Gets or sets the mean of the distribution for the POP /// [kN/m²] /// public double PopMean { get; set; } = double.NaN; /// - /// Gets or sets the deviation of the distribution for the POP of the . + /// Gets or sets the deviation of the distribution for the POP. /// [kN/m²] /// public double PopDeviation { get; set; } = double.NaN; /// - /// Gets or sets the shift of the distribution for the POP of the . + /// Gets or sets the shift of the distribution for the POP. /// [kN/m²] /// public double PopShift { get; set; } = double.NaN; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilLayerUnderSurfaceLineTest.cs =================================================================== diff -u -r11770f197071c45397a34ec91fc3981acf05c850 -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilLayerUnderSurfaceLineTest.cs (.../SoilLayerUnderSurfaceLineTest.cs) (revision 11770f197071c45397a34ec91fc3981acf05c850) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilLayerUnderSurfaceLineTest.cs (.../SoilLayerUnderSurfaceLineTest.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -91,7 +91,7 @@ { // Call var outerRing = new Point2D[0]; - var holes = Enumerable.Empty(); + IEnumerable holes = Enumerable.Empty(); var properties = new SoilLayerProperties(); // Setup Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -254,17 +254,34 @@ StochasticSoilProfile profileA = CreateRandomStochasticProfile(21); StochasticSoilProfile profileB = CreateRandomStochasticProfile(21); StochasticSoilProfile profileC = CreateRandomStochasticProfile(73); + StochasticSoilProfile profileD = CreateRandomStochasticProfile(21); var profileE = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 25); var profileF = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 45); var profileG = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile2D, 25); var profileH = new StochasticSoilProfile(0.15, SoilProfileType.SoilProfile1D, 25); + var profileI = new StochasticSoilProfile(0.15, SoilProfileType.SoilProfile1D, 25) + { + SoilProfile = CreateRandomProfile(new Random(12)) + }; + var profileJ = new StochasticSoilProfile(0.15, SoilProfileType.SoilProfile1D, 25) + { + SoilProfile = CreateRandomProfile(new Random(32)) + }; return new[] { new TestCaseData(profileA, profileB, true) { TestName = "Equals_ProfileAProfileB_True" }, + new TestCaseData(profileB, profileD, true) + { + TestName = "Equals_ProfileBProfileD_True" + }, + new TestCaseData(profileA, profileD, true) + { + TestName = "Equals_ProfileAProfileD_True" + }, new TestCaseData(profileB, profileC, false) { TestName = "Equals_ProfileBProfileC_False" @@ -284,6 +301,10 @@ new TestCaseData(profileE, profileH, false) { TestName = "Equals_DifferentProbability_False" + }, + new TestCaseData(profileI, profileJ, false) + { + TestName = "Equals_DifferentProfile_False" } }; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorInputTest.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorInputTest.cs (.../MacroStabilityInwardsCalculatorInputTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/MacroStabilityInwardsCalculatorInputTest.cs (.../MacroStabilityInwardsCalculatorInputTest.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -21,6 +21,7 @@ using System; using NUnit.Framework; +using Rhino.Mocks; using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.KernelWrapper.Test @@ -43,20 +44,14 @@ public void Constructor_WithConstructionProperties_PropertiesAreSet() { // Setup + var mocks = new MockRepository(); + var soilProfile = mocks.Stub(); + mocks.ReplayAll(); + var random = new Random(11); double hRiverValue = random.NextDouble(); var surfaceLine = new MacroStabilityInwardsSurfaceLine(); - var soilProfile = new MacroStabilityInwardsSoilProfile1D(string.Empty, random.NextDouble(), new[] - { - new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) - { - Properties = - { - IsAquifer = true - } - } - }, SoilProfileType.SoilProfile1D, 0); // Call var input = new MacroStabilityInwardsCalculatorInput( @@ -71,6 +66,8 @@ Assert.AreEqual(hRiverValue, input.AssessmentLevel); Assert.AreSame(surfaceLine, input.SurfaceLine); Assert.AreSame(soilProfile, input.SoilProfile); + + mocks.VerifyAll(); } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj =================================================================== diff -u -r620846e4cf00b13e9310c931d29bac47799a81d8 -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 620846e4cf00b13e9310c931d29bac47799a81d8) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -45,6 +45,10 @@ ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll True + + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll + True + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/packages.config =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/packages.config (.../packages.config) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/packages.config (.../packages.config) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -1,4 +1,5 @@ - + \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer1DTest.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer1DTest.cs (.../MacroStabilityInwardsSoilLayer1DTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer1DTest.cs (.../MacroStabilityInwardsSoilLayer1DTest.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -59,6 +59,7 @@ Assert.AreEqual(layerA.GetHashCode(), layerB.GetHashCode()); Assert.AreEqual(layerB.GetHashCode(), layerA.GetHashCode()); } + [Test] public void Equals_DerivedClassWithEqualProperties_ReturnsTrue() { @@ -73,37 +74,6 @@ Assert.IsTrue(areEqual); } - private class TestLayer : MacroStabilityInwardsSoilLayer1D - { - public TestLayer(MacroStabilityInwardsSoilLayer1D layer) - : base(layer.Top) - { - Properties.IsAquifer = layer.Properties.IsAquifer; - Properties.Color = layer.Properties.Color; - Properties.MaterialName = layer.Properties.MaterialName; - Properties.ShearStrengthModel = layer.Properties.ShearStrengthModel; - Properties.AbovePhreaticLevelMean = layer.Properties.AbovePhreaticLevelMean; - Properties.AbovePhreaticLevelDeviation = layer.Properties.AbovePhreaticLevelDeviation; - Properties.BelowPhreaticLevelMean = layer.Properties.BelowPhreaticLevelMean; - Properties.BelowPhreaticLevelDeviation = layer.Properties.BelowPhreaticLevelDeviation; - Properties.CohesionMean = layer.Properties.CohesionMean; - Properties.CohesionDeviation = layer.Properties.CohesionDeviation; - Properties.CohesionShift = layer.Properties.CohesionShift; - Properties.FrictionAngleMean = layer.Properties.FrictionAngleMean; - Properties.FrictionAngleDeviation = layer.Properties.FrictionAngleDeviation; - Properties.FrictionAngleShift = layer.Properties.FrictionAngleShift; - Properties.StrengthIncreaseExponentMean = layer.Properties.StrengthIncreaseExponentMean; - Properties.StrengthIncreaseExponentDeviation = layer.Properties.StrengthIncreaseExponentDeviation; - Properties.StrengthIncreaseExponentShift = layer.Properties.StrengthIncreaseExponentShift; - Properties.ShearStrengthRatioMean = layer.Properties.ShearStrengthRatioMean; - Properties.ShearStrengthRatioDeviation = layer.Properties.ShearStrengthRatioDeviation; - Properties.ShearStrengthRatioShift = layer.Properties.ShearStrengthRatioShift; - Properties.PopMean = layer.Properties.PopMean; - Properties.PopDeviation = layer.Properties.PopDeviation; - Properties.PopShift = layer.Properties.PopShift; - } - } - [Test] public void Equals_DifferentType_ReturnsFalse() { @@ -143,12 +113,66 @@ Assert.AreEqual(expectedEqual, areEqualTwo); } + private class TestLayer : MacroStabilityInwardsSoilLayer1D + { + public TestLayer(MacroStabilityInwardsSoilLayer1D layer) + : base(layer.Top) + { + Properties.IsAquifer = layer.Properties.IsAquifer; + Properties.Color = layer.Properties.Color; + Properties.MaterialName = layer.Properties.MaterialName; + Properties.ShearStrengthModel = layer.Properties.ShearStrengthModel; + Properties.AbovePhreaticLevelMean = layer.Properties.AbovePhreaticLevelMean; + Properties.AbovePhreaticLevelDeviation = layer.Properties.AbovePhreaticLevelDeviation; + Properties.BelowPhreaticLevelMean = layer.Properties.BelowPhreaticLevelMean; + Properties.BelowPhreaticLevelDeviation = layer.Properties.BelowPhreaticLevelDeviation; + Properties.CohesionMean = layer.Properties.CohesionMean; + Properties.CohesionDeviation = layer.Properties.CohesionDeviation; + Properties.CohesionShift = layer.Properties.CohesionShift; + Properties.FrictionAngleMean = layer.Properties.FrictionAngleMean; + Properties.FrictionAngleDeviation = layer.Properties.FrictionAngleDeviation; + Properties.FrictionAngleShift = layer.Properties.FrictionAngleShift; + Properties.StrengthIncreaseExponentMean = layer.Properties.StrengthIncreaseExponentMean; + Properties.StrengthIncreaseExponentDeviation = layer.Properties.StrengthIncreaseExponentDeviation; + Properties.StrengthIncreaseExponentShift = layer.Properties.StrengthIncreaseExponentShift; + Properties.ShearStrengthRatioMean = layer.Properties.ShearStrengthRatioMean; + Properties.ShearStrengthRatioDeviation = layer.Properties.ShearStrengthRatioDeviation; + Properties.ShearStrengthRatioShift = layer.Properties.ShearStrengthRatioShift; + Properties.PopMean = layer.Properties.PopMean; + Properties.PopDeviation = layer.Properties.PopDeviation; + Properties.PopShift = layer.Properties.PopShift; + } + } + private static TestCaseData[] LayerCombinations() { MacroStabilityInwardsSoilLayer1D layerA = CreateRandomLayer(21); MacroStabilityInwardsSoilLayer1D layerB = CreateRandomLayer(21); MacroStabilityInwardsSoilLayer1D layerC = CreateRandomLayer(73); + MacroStabilityInwardsSoilLayer1D layerD = CreateRandomLayer(21); + var layerE = new MacroStabilityInwardsSoilLayer1D(3) + { + Properties = + { + Color = Color.Blue + } + }; + var layerF = new MacroStabilityInwardsSoilLayer1D(4) + { + Properties = + { + Color = Color.Blue + } + }; + var layerG = new MacroStabilityInwardsSoilLayer1D(3) + { + Properties = + { + Color = Color.Gold + } + }; + return new[] { new TestCaseData(layerA, layerA, true) @@ -159,13 +183,33 @@ { TestName = "Equals_LayerALayerB_True" }, + new TestCaseData(layerB, layerD, true) + { + TestName = "Equals_LayerALayerD_True" + }, + new TestCaseData(layerA, layerD, true) + { + TestName = "Equals_LayerALayerD_True" + }, new TestCaseData(layerB, layerC, false) { TestName = "Equals_LayerBLayerC_False" }, + new TestCaseData(layerA, layerC, false) + { + TestName = "Equals_LayerALayerC_False" + }, new TestCaseData(layerC, layerC, true) { TestName = "Equals_LayerCLayerC_True" + }, + new TestCaseData(layerE, layerF, false) + { + TestName = "Equals_DifferentTop_False" + }, + new TestCaseData(layerE, layerG, false) + { + TestName = "Equals_DifferentProperties_False" } }; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer2DTest.cs =================================================================== diff -u -r677ec9937ae7eff73a09bf937804ad22e0dc5a4b -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer2DTest.cs (.../MacroStabilityInwardsSoilLayer2DTest.cs) (revision 677ec9937ae7eff73a09bf937804ad22e0dc5a4b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSoilLayer2DTest.cs (.../MacroStabilityInwardsSoilLayer2DTest.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -204,7 +204,45 @@ MacroStabilityInwardsSoilLayer2D layerA = CreateRandomLayer(21); MacroStabilityInwardsSoilLayer2D layerB = CreateRandomLayer(21); MacroStabilityInwardsSoilLayer2D layerC = CreateRandomLayer(73); + MacroStabilityInwardsSoilLayer2D layerD = CreateRandomLayer(21); + var layerE = new MacroStabilityInwardsSoilLayer2D( + CreateRandomRing(new Random(21)), + new [] { CreateRandomRing(new Random(22))}) + { + Properties = + { + Color = Color.Blue + } + }; + var layerF = new MacroStabilityInwardsSoilLayer2D( + CreateRandomRing(new Random(31)), + new [] { CreateRandomRing(new Random(22))}) + { + Properties = + { + Color = Color.Blue + } + }; + var layerG = new MacroStabilityInwardsSoilLayer2D( + CreateRandomRing(new Random(21)), + new[] { CreateRandomRing(new Random(32)) }) + { + Properties = + { + Color = Color.Blue + } + }; + var layerH = new MacroStabilityInwardsSoilLayer2D( + CreateRandomRing(new Random(21)), + new[] { CreateRandomRing(new Random(22)) }) + { + Properties = + { + Color = Color.Gold + } + }; + return new[] { new TestCaseData(layerA, layerA, true) @@ -215,31 +253,47 @@ { TestName = "Equals_LayerALayerB_True" }, + new TestCaseData(layerB, layerD, true) + { + TestName = "Equals_LayerALayerD_True" + }, + new TestCaseData(layerA, layerD, true) + { + TestName = "Equals_LayerALayerD_True" + }, new TestCaseData(layerB, layerC, false) { TestName = "Equals_LayerBLayerC_False" }, + new TestCaseData(layerA, layerC, false) + { + TestName = "Equals_LayerALayerC_False" + }, new TestCaseData(layerC, layerC, true) { TestName = "Equals_LayerCLayerC_True" + }, + new TestCaseData(layerE, layerF, false) + { + TestName = "Equals_DifferentOuterRing_False" + }, + new TestCaseData(layerE, layerG, false) + { + TestName = "Equals_DifferentHoles_False" + }, + new TestCaseData(layerE, layerH, false) + { + TestName = "Equals_DifferentProperties_False" } }; } private static MacroStabilityInwardsSoilLayer2D CreateRandomLayer(int randomSeed) { var random = new Random(randomSeed); - return new MacroStabilityInwardsSoilLayer2D(new Ring(new[] + return new MacroStabilityInwardsSoilLayer2D(CreateRandomRing(random), new[] { - new Point2D(random.NextDouble(), random.NextDouble()), - new Point2D(random.NextDouble(), random.NextDouble()) - }), new[] - { - new Ring(new[] - { - new Point2D(random.NextDouble(), random.NextDouble()), - new Point2D(random.NextDouble(), random.NextDouble()) - }) + CreateRandomRing(random) }) { Properties = @@ -248,5 +302,14 @@ } }; } + + private static Ring CreateRandomRing(Random random) + { + return new Ring(new[] + { + new Point2D(random.NextDouble(), random.NextDouble()), + new Point2D(random.NextDouble(), random.NextDouble()) + }); + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs =================================================================== diff -u -r11770f197071c45397a34ec91fc3981acf05c850 -r133ab46a14ee9508c8dd5e4f82381da606076ae0 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 11770f197071c45397a34ec91fc3981acf05c850) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 133ab46a14ee9508c8dd5e4f82381da606076ae0) @@ -248,7 +248,6 @@ Assert.AreEqual(stochasticSoilProfile.SoilProfile.ToString(), text); } - private class TestStochasticSoilProfile : StochasticSoilProfile { public TestStochasticSoilProfile(StochasticSoilProfile profile) @@ -295,6 +294,16 @@ StochasticSoilProfile profileD = CreateRandomStochasticProfile(21); var profileE = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 25); var profileF = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile1D, 45); + var profileG = new StochasticSoilProfile(0.5, SoilProfileType.SoilProfile2D, 25); + var profileH = new StochasticSoilProfile(0.15, SoilProfileType.SoilProfile1D, 25); + var profileI = new StochasticSoilProfile(0.15, SoilProfileType.SoilProfile1D, 25) + { + SoilProfile = CreateRandomProfile(new Random(12)) + }; + var profileJ = new StochasticSoilProfile(0.15, SoilProfileType.SoilProfile1D, 25) + { + SoilProfile = CreateRandomProfile(new Random(32)) + }; return new[] { @@ -321,6 +330,18 @@ new TestCaseData(profileE, profileF, true) { TestName = "Equals_DifferentIds_True" + }, + new TestCaseData(profileE, profileG, false) + { + TestName = "Equals_DifferentTypes_False" + }, + new TestCaseData(profileE, profileH, false) + { + TestName = "Equals_DifferentProbability_False" + }, + new TestCaseData(profileI, profileJ, false) + { + TestName = "Equals_DifferentProfile_False" } }; }