Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs =================================================================== diff -u -r93acf9b0dcf191ef5088f4d822a81b1759c10532 -r604dfe021f6161f8e5d107dd5821ba06390c5ecf --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -728,6 +728,15 @@ } /// + /// Looks up a localized string similar to Grensspanning. + /// + public static string PreconsolidationStress_Name { + get { + return ResourceManager.GetString("PreconsolidationStress_Name", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kans moet in het bereik {0} liggen.. /// public static string Probability_Must_be_in_Range_0_ { Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx =================================================================== diff -u -r93acf9b0dcf191ef5088f4d822a81b1759c10532 -r604dfe021f6161f8e5d107dd5821ba06390c5ecf --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -387,4 +387,7 @@ Kruin buitentalud + + Grensspanning + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj =================================================================== diff -u -rf23ce41a1dd004c56ab38179b6b28cd389edba36 -r604dfe021f6161f8e5d107dd5821ba06390c5ecf --- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision f23ce41a1dd004c56ab38179b6b28cd389edba36) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -145,7 +145,7 @@ - + Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/DistributionHelper.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/DistributionHelper.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/DistributionHelper.cs (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -0,0 +1,86 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.Exceptions; +using Ringtoets.Common.IO.Properties; + +namespace Ringtoets.Common.IO.SoilProfile +{ + /// + /// Class which provides helper methods for validating distributions coming from + /// D-Soil model files. + /// + public static class DistributionHelper + { + private const double tolerance = 1e-6; + + /// + /// Validates that the distribution is a non-shifted log normal distribution. + /// + /// The distribution type. + /// The value of the shift. + /// The name of the parameter to be validated. + /// Thrown when + /// is null. + /// Thrown when the parameter is not a + /// log normal distribution with a zero shift. + public static void ValidateIsNonShiftedLogNormal(long? distributionType, double shift, string parameterName) + { + if (parameterName == null) + { + throw new ArgumentNullException(nameof(parameterName)); + } + + if (distributionType.HasValue && (distributionType.Value != SoilLayerConstants.LogNormalDistributionValue + || Math.Abs(shift) > tolerance)) + { + throw new ImportedDataTransformException(string.Format( + Resources.SoilLayer_Stochastic_parameter_0_has_no_lognormal_distribution, + parameterName)); + } + } + + /// + /// Validates that the distribution is a log normal distribution. + /// + /// The distribution type. + /// The name of the parameter to be validated. + /// Thrown when + /// is null. + /// Thrown when the parameter is not a + /// log-normal distribution. + public static void ValidateIsLogNormal(long? distributionType, string parameterName) + { + if (parameterName == null) + { + throw new ArgumentNullException(nameof(parameterName)); + } + + if (distributionType.HasValue && distributionType != SoilLayerConstants.LogNormalDistributionValue) + { + throw new ImportedDataTransformException(string.Format( + Resources.SoilLayer_Stochastic_parameter_0_has_no_shifted_lognormal_distribution, + parameterName)); + } + } + } +} \ No newline at end of file Fisheye: Tag 604dfe021f6161f8e5d107dd5821ba06390c5ecf refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayerDistributionHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj =================================================================== diff -u -r207d916eaef6ef69b3ca14fe0302a7d83dce255c -r604dfe021f6161f8e5d107dd5821ba06390c5ecf --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 207d916eaef6ef69b3ca14fe0302a7d83dce255c) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -126,7 +126,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/DistributionHelperTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/DistributionHelperTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/DistributionHelperTest.cs (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -0,0 +1,163 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Ringtoets.Common.IO.Exceptions; +using Ringtoets.Common.IO.SoilProfile; + +namespace Ringtoets.Common.IO.Test.SoilProfile +{ + [TestFixture] + public class DistributionHelperTest + { + [Test] + public void ValidateIsNonShiftedLogNormal_ParameterNameNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + long distributionType = random.Next(); + double shift = random.NextDouble(); + + // Call + TestDelegate call = () => DistributionHelper.ValidateIsNonShiftedLogNormal(distributionType, + shift, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("parameterName", exception.ParamName); + } + + [Test] + [TestCase(-1, 0)] + [TestCase(3, 10)] + public void ValidateIsNonShiftedLogNormal_InvalidDistributionProperties_ThrowsImportedDataException( + long distributionType, + double shift) + { + // Setup + const string parameterName = "Just a name"; + + // Call + TestDelegate call = () => DistributionHelper.ValidateIsNonShiftedLogNormal(distributionType, + shift, + parameterName); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual($"Parameter '{parameterName}' is niet lognormaal verdeeld.", exception.Message); + } + + [Test] + public void ValidateIsNonShiftedLogNormal_ValidDistribution_DoesNotThrowException() + { + // Setup + const long distributionType = 3; + const double shift = 0; + + // Call + TestDelegate call = () => DistributionHelper.ValidateIsNonShiftedLogNormal(distributionType, + shift, + string.Empty); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + public void ValidateIsNonShiftedLogNormal_DistributionTypeNull_DoesNotThrowException() + { + // Setup + var random = new Random(21); + double shift = random.NextDouble(); + const string parameterName = "Just a name"; + + // Call + TestDelegate call = () => DistributionHelper.ValidateIsNonShiftedLogNormal(null, + shift, + parameterName); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + public void ValidateIsLogNormal_ParameterNameNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + long distributionType = random.Next(); + + // Call + TestDelegate call = () => DistributionHelper.ValidateIsLogNormal(distributionType, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("parameterName", exception.ParamName); + } + + [Test] + public void ValidateIsLogNormal_InvalidDistributionProperties_ThrowsImportedDataException() + { + // Setup + const long invalidDistributionType = -1; + const string parameterName = "Just a name"; + + // Call + TestDelegate call = () => DistributionHelper.ValidateIsLogNormal(invalidDistributionType, + parameterName); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual($"Parameter '{parameterName}' is niet verschoven lognormaal verdeeld.", exception.Message); + } + + [Test] + public void ValidateIsLogNormal_ValidDistribution_DoesNotThrowException() + { + // Setup + const long distributionType = 3; + + // Call + TestDelegate call = () => DistributionHelper.ValidateIsLogNormal(distributionType, + string.Empty); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + public void ValidateIsLogNormal_DistributionTypeNull_DoesNotThrowException() + { + // Setup + const string parameterName = "Just a name"; + + // Call + TestDelegate call = () => DistributionHelper.ValidateIsLogNormal(null, + parameterName); + + // Assert + Assert.DoesNotThrow(call); + } + } +} \ No newline at end of file Fisheye: Tag 604dfe021f6161f8e5d107dd5821ba06390c5ecf refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayerDistributionHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj =================================================================== diff -u -r91dfcac4a3eff0748168e9fc8e9400e209844363 -r604dfe021f6161f8e5d107dd5821ba06390c5ecf --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj (.../Ringtoets.MacroStabilityInwards.IO.csproj) (revision 91dfcac4a3eff0748168e9fc8e9400e209844363) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj (.../Ringtoets.MacroStabilityInwards.IO.csproj) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -38,6 +38,7 @@ + Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformer.cs (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -0,0 +1,73 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.Exceptions; +using Ringtoets.Common.IO.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; + +namespace Ringtoets.MacroStabilityInwards.IO.SoilProfiles +{ + /// + /// Transforms a generic into a + /// . + /// + internal static class MacroStabilityInwardsPreconsolidationStressTransformer + { + /// + /// Transforms the generic into + /// a . + /// + /// The preconsolidation stress to use + /// in the transformation. + /// A + /// based on the given data. + /// Thrown when + /// is null. + /// Thrown when the + /// could not be transformed into + /// a . + public static MacroStabilityInwardsPreconsolidationStress Transform(PreconsolidationStress preconsolidationStress) + { + if (preconsolidationStress == null) + { + throw new ArgumentNullException(nameof(preconsolidationStress)); + } + + DistributionHelper.ValidateIsNonShiftedLogNormal(preconsolidationStress.PreconsolidationStressDistributionType, + preconsolidationStress.PreconsolidationStressShift, + RingtoetsCommonDataResources.PreconsolidationStress_Name); + + try + { + return new MacroStabilityInwardsPreconsolidationStress(preconsolidationStress.XCoordinate, + preconsolidationStress.ZCoordinate, + preconsolidationStress.PreconsolidationStressMean, + preconsolidationStress.PreconsolidationStressCoefficientOfVariation); + } + catch (ArgumentException e) + { + throw new ImportedDataTransformException(e.Message, e); + } + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs =================================================================== diff -u -r6f1f1f2dc45d71b0b40c6a84ed233d50f04c4b62 -r604dfe021f6161f8e5d107dd5821ba06390c5ecf --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs (.../MacroStabilityInwardsSoilLayerTransformer.cs) (revision 6f1f1f2dc45d71b0b40c6a84ed233d50f04c4b62) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs (.../MacroStabilityInwardsSoilLayerTransformer.cs) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -230,34 +230,34 @@ /// stochastic parameters is not defined as lognormal or is shifted when it should not be. private static void ValidateStochasticParameters(SoilLayerBase soilLayer) { - SoilLayerDistributionHelper.ValidateIsLogNormal(soilLayer.AbovePhreaticLevelDistributionType, + DistributionHelper.ValidateIsLogNormal(soilLayer.AbovePhreaticLevelDistributionType, Resources.SoilLayerProperties_AbovePhreaticLevelDistribution_Description); - SoilLayerDistributionHelper.ValidateIsLogNormal( + DistributionHelper.ValidateIsLogNormal( soilLayer.BelowPhreaticLevelDistributionType, Resources.SoilLayerProperties_BelowPhreaticLevelDistribution_Description); - SoilLayerDistributionHelper.ValidateIsNonShiftedLogNormal( + DistributionHelper.ValidateIsNonShiftedLogNormal( soilLayer.CohesionDistributionType, soilLayer.CohesionShift, Resources.SoilLayerProperties_CohesionDistribution_Description); - SoilLayerDistributionHelper.ValidateIsNonShiftedLogNormal( + DistributionHelper.ValidateIsNonShiftedLogNormal( soilLayer.FrictionAngleDistributionType, soilLayer.FrictionAngleShift, Resources.SoilLayerProperties_FrictionAngleDistribution_Description); - SoilLayerDistributionHelper.ValidateIsNonShiftedLogNormal( + DistributionHelper.ValidateIsNonShiftedLogNormal( soilLayer.ShearStrengthRatioDistributionType, soilLayer.ShearStrengthRatioShift, Resources.SoilLayerProperties_ShearStrengthRatioDistribution_Description); - SoilLayerDistributionHelper.ValidateIsNonShiftedLogNormal( + DistributionHelper.ValidateIsNonShiftedLogNormal( soilLayer.StrengthIncreaseExponentDistributionType, soilLayer.StrengthIncreaseExponentShift, Resources.SoilLayerProperties_StrengthIncreaseExponentDistribution_Description); - SoilLayerDistributionHelper.ValidateIsNonShiftedLogNormal( + DistributionHelper.ValidateIsNonShiftedLogNormal( soilLayer.PopDistributionType, soilLayer.PopShift, Resources.SoilLayerProperties_PopDistribution_Description); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj =================================================================== diff -u -r91dfcac4a3eff0748168e9fc8e9400e209844363 -r604dfe021f6161f8e5d107dd5821ba06390c5ecf --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision 91dfcac4a3eff0748168e9fc8e9400e209844363) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -64,6 +64,7 @@ + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformerTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformerTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsPreconsolidationStressTransformerTest.cs (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -0,0 +1,153 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using NUnit.Framework; +using Ringtoets.Common.IO.Exceptions; +using Ringtoets.Common.IO.SoilProfile; +using Ringtoets.MacroStabilityInwards.IO.SoilProfiles; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.IO.Test.SoilProfiles +{ + [TestFixture] + public class MacroStabilityInwardsPreconsolidationStressTransformerTest + { + [Test] + public void Transform_PreconsolidationStressNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => MacroStabilityInwardsPreconsolidationStressTransformer.Transform(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("preconsolidationStress", exception.ParamName); + } + + [Test] + public void Transform_ValidPreconsolidationStress_ReturnMacroStabilityInwardsPreconsolidationStress() + { + // Setup + var random = new Random(21); + var preconsolidationStress = new PreconsolidationStress + { + XCoordinate = random.NextDouble(), + ZCoordinate = random.NextDouble(), + PreconsolidationStressDistributionType = 3, + PreconsolidationStressMean = random.NextDouble(), + PreconsolidationStressCoefficientOfVariation = random.NextDouble(), + PreconsolidationStressShift = 0 + }; + + // Call + MacroStabilityInwardsPreconsolidationStress transformedStress = + MacroStabilityInwardsPreconsolidationStressTransformer.Transform(preconsolidationStress); + + // Assert + Assert.AreEqual(preconsolidationStress.XCoordinate, transformedStress.XCoordinate); + Assert.AreEqual(preconsolidationStress.ZCoordinate, transformedStress.ZCoordinate); + Assert.AreEqual(preconsolidationStress.PreconsolidationStressMean, transformedStress.PreconsolidationStressMean); + Assert.AreEqual(preconsolidationStress.PreconsolidationStressCoefficientOfVariation, + transformedStress.PreconsolidationStressCoefficientOfVariation); + } + + [Test] + [TestCaseSource(nameof(GetInvalidPreconsolidationStress))] + public void Transform_InvalidPreconsolidationStressValues_ThrowsImportedDataTransformException( + PreconsolidationStress preconsolidationStress, + string parameterName) + { + // Call + TestDelegate call = () => MacroStabilityInwardsPreconsolidationStressTransformer.Transform(preconsolidationStress); + + // Assert + var exception = Assert.Throws(call); + string expectedMessage = $"De waarde voor '{parameterName}' moet een concreet getal zijn."; + Assert.AreEqual(expectedMessage, exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + [TestCaseSource(nameof(GetInvalidStochastConfiguration))] + public void Transform_InvalidStochasticDistributionProperties_ThrowsImportedDataTransformException( + PreconsolidationStress preconsolidationStress) + { + // Call + TestDelegate call = () => MacroStabilityInwardsPreconsolidationStressTransformer.Transform(preconsolidationStress); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual($"Parameter 'Grensspanning' is niet lognormaal verdeeld.", exception.Message); + } + + private static IEnumerable GetInvalidStochastConfiguration() + { + var random = new Random(21); + + yield return new TestCaseData(new PreconsolidationStress + { + PreconsolidationStressDistributionType = random.Next(), + PreconsolidationStressShift = 0 + }).SetName("Invalid DistributionType"); + + yield return new TestCaseData(new PreconsolidationStress + { + PreconsolidationStressDistributionType = 3, + PreconsolidationStressShift = random.NextDouble() + }).SetName("Invalid Shift"); + } + + private static IEnumerable GetInvalidPreconsolidationStress() + { + var random = new Random(21); + double xCoordinate = random.NextDouble(); + double zCoordinate = random.NextDouble(); + double preconsolidationStressMean = random.NextDouble(); + double preconsolidationStressCoefficientOfVariation = random.NextDouble(); + + yield return new TestCaseData(new PreconsolidationStress + { + ZCoordinate = zCoordinate, + PreconsolidationStressMean = preconsolidationStressMean, + PreconsolidationStressCoefficientOfVariation = preconsolidationStressCoefficientOfVariation + }, "X-coördinaat").SetName("Invalid XCoordinate"); + yield return new TestCaseData(new PreconsolidationStress + { + XCoordinate = xCoordinate, + PreconsolidationStressMean = preconsolidationStressMean, + PreconsolidationStressCoefficientOfVariation = preconsolidationStressCoefficientOfVariation + }, "Z-coördinaat").SetName("Invalid ZCoordinate"); + yield return new TestCaseData(new PreconsolidationStress + { + XCoordinate = xCoordinate, + ZCoordinate = zCoordinate, + PreconsolidationStressCoefficientOfVariation = preconsolidationStressCoefficientOfVariation + }, "gemiddelde").SetName("Invalid Mean"); + yield return new TestCaseData(new PreconsolidationStress + { + XCoordinate = xCoordinate, + ZCoordinate = zCoordinate, + PreconsolidationStressMean = preconsolidationStressMean + }, "variatiecoëfficient").SetName("Invalid Coefficient of Variation"); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs =================================================================== diff -u -r4d10bc0d4756085a58be2734b2877cead7f47973 -r604dfe021f6161f8e5d107dd5821ba06390c5ecf --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs (.../PipingSoilLayerTransformer.cs) (revision 4d10bc0d4756085a58be2734b2877cead7f47973) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs (.../PipingSoilLayerTransformer.cs) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) @@ -124,14 +124,14 @@ /// stochastic parameters is not defined as lognormal or is shifted when it should not be. private static void ValidateStochasticParameters(SoilLayerBase soilLayer) { - SoilLayerDistributionHelper.ValidateIsLogNormal( + DistributionHelper.ValidateIsLogNormal( soilLayer.BelowPhreaticLevelDistributionType, Resources.SoilLayer_BelowPhreaticLevelDistribution_Description); - SoilLayerDistributionHelper.ValidateIsNonShiftedLogNormal( + DistributionHelper.ValidateIsNonShiftedLogNormal( soilLayer.DiameterD70DistributionType, soilLayer.DiameterD70Shift, Resources.SoilLayer_DiameterD70Distribution_Description); - SoilLayerDistributionHelper.ValidateIsNonShiftedLogNormal( + DistributionHelper.ValidateIsNonShiftedLogNormal( soilLayer.PermeabilityDistributionType, soilLayer.PermeabilityShift, Resources.SoilLayer_PermeabilityDistribution_Description);