Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/LogNormalDistribution.cs =================================================================== diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/LogNormalDistribution.cs (.../LogNormalDistribution.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/LogNormalDistribution.cs (.../LogNormalDistribution.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -80,7 +80,7 @@ RoundedDouble newShift = value.ToPrecision(shift.NumberOfDecimalPlaces); if (newShift > Mean) { - throw new ArgumentOutOfRangeException(Resources.LogNormalDistribution_Shift_may_not_exceed_Mean); + throw new ArgumentOutOfRangeException(null, Resources.LogNormalDistribution_Shift_may_not_exceed_Mean); } shift = newShift; } @@ -104,11 +104,11 @@ if (roundedValue <= 0) { - throw new ArgumentOutOfRangeException(nameof(value), Resources.LogNormalDistribution_Mean_must_be_greater_than_zero); + throw new ArgumentOutOfRangeException(null, Resources.LogNormalDistribution_Mean_must_be_greater_than_zero); } if (Shift > roundedValue) { - throw new ArgumentOutOfRangeException(Resources.LogNormalDistribution_Shift_may_not_exceed_Mean); + throw new ArgumentOutOfRangeException(null, Resources.LogNormalDistribution_Shift_may_not_exceed_Mean); } mean = roundedValue; @@ -133,7 +133,7 @@ if (roundedValue < 0) { - throw new ArgumentOutOfRangeException(nameof(value), Resources.StandardDeviation_Should_be_greater_or_equal_zero); + throw new ArgumentOutOfRangeException(null, Resources.StandardDeviation_Should_be_greater_or_equal_zero); } standardDeviation = roundedValue; Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/NormalDistribution.cs =================================================================== diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/NormalDistribution.cs (.../NormalDistribution.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/NormalDistribution.cs (.../NormalDistribution.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -80,7 +80,7 @@ if (roundedValue < 0) { - throw new ArgumentOutOfRangeException(nameof(value), Resources.StandardDeviation_Should_be_greater_or_equal_zero); + throw new ArgumentOutOfRangeException(null, Resources.StandardDeviation_Should_be_greater_or_equal_zero); } standardDeviation = roundedValue; Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/PercentileBasedDesignVariable.cs =================================================================== diff -u -r974fb1eadbd8a630c7a992648ad42ac85ec205b1 -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/PercentileBasedDesignVariable.cs (.../PercentileBasedDesignVariable.cs) (revision 974fb1eadbd8a630c7a992648ad42ac85ec205b1) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/PercentileBasedDesignVariable.cs (.../PercentileBasedDesignVariable.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -67,7 +67,7 @@ { string message = string.Format(Resources.DesignVariable_Percentile_must_be_in_Range_0_, percentileValidityRange.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture)); - throw new ArgumentOutOfRangeException(nameof(value), message); + throw new ArgumentOutOfRangeException(null, message); } percentile = value; } Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientLogNormalDistribution.cs =================================================================== diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientLogNormalDistribution.cs (.../VariationCoefficientLogNormalDistribution.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientLogNormalDistribution.cs (.../VariationCoefficientLogNormalDistribution.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -74,7 +74,7 @@ if (roundedValue <= 0) { - throw new ArgumentOutOfRangeException(nameof(value), Resources.LogNormalDistribution_Mean_must_be_greater_than_zero); + throw new ArgumentOutOfRangeException(null, Resources.LogNormalDistribution_Mean_must_be_greater_than_zero); } mean = roundedValue; @@ -93,7 +93,7 @@ if (roundedValue < 0) { - throw new ArgumentOutOfRangeException(nameof(value), Resources.CoefficientOfVariation_Should_be_greater_or_equal_to_zero); + throw new ArgumentOutOfRangeException(null, Resources.CoefficientOfVariation_Should_be_greater_or_equal_to_zero); } coefficientOfVariation = roundedValue; Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientNormalDistribution.cs =================================================================== diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientNormalDistribution.cs (.../VariationCoefficientNormalDistribution.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientNormalDistribution.cs (.../VariationCoefficientNormalDistribution.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -80,7 +80,7 @@ if (roundedValue < 0) { - throw new ArgumentOutOfRangeException(nameof(value), Resources.CoefficientOfVariation_Should_be_greater_or_equal_to_zero); + throw new ArgumentOutOfRangeException(null, Resources.CoefficientOfVariation_Should_be_greater_or_equal_to_zero); } coefficientOfVariation = roundedValue; Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/LogNormalDistributionTest.cs =================================================================== diff -u -r1bd1adf2f50f50a4043cb3ae1f159979f8e59d90 -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/LogNormalDistributionTest.cs (.../LogNormalDistributionTest.cs) (revision 1bd1adf2f50f50a4043cb3ae1f159979f8e59d90) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/LogNormalDistributionTest.cs (.../LogNormalDistributionTest.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -184,8 +184,8 @@ TestDelegate call = () => distribution.Shift = new RoundedDouble(2, 100.0); // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("De verschuiving mag niet groter zijn dan de verwachtingswaarde.", paramName); + const string expectedMessage = "De verschuiving mag niet groter zijn dan de verwachtingswaarde."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingConfigurationImporter.cs =================================================================== diff -u -r95c3b399555a6035f68d4d19fbbd32680895b67f -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingConfigurationImporter.cs (.../PipingConfigurationImporter.cs) (revision 95c3b399555a6035f68d4d19fbbd32680895b67f) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingConfigurationImporter.cs (.../PipingConfigurationImporter.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -34,6 +34,7 @@ using Ringtoets.Piping.Data; using Ringtoets.Piping.IO.Properties; using Ringtoets.Piping.IO.Readers; +using Ringtoets.Piping.IO.Schema; using Ringtoets.Piping.Primitives; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; @@ -245,20 +246,20 @@ { if (readCalculation.EntryPointL.HasValue) { - var valueToSet = (double) readCalculation.EntryPointL; + var entryPoint = (double) readCalculation.EntryPointL; PerformActionHandlingAnyArgumentOutOfRangeException( - () => pipingCalculation.InputParameters.EntryPointL = (RoundedDouble) valueToSet, - string.Format(Resources.PipingConfigurationImporter_ReadEntryExitPoint_Entry_point_invalid, valueToSet)); + () => pipingCalculation.InputParameters.EntryPointL = (RoundedDouble) entryPoint, + string.Format(Resources.PipingConfigurationImporter_ReadEntryExitPoint_Entry_point_invalid, entryPoint)); } if (readCalculation.ExitPointL.HasValue) { - var valueToSet = (double) readCalculation.ExitPointL; + var exitPoint = (double) readCalculation.ExitPointL; PerformActionHandlingAnyArgumentOutOfRangeException( - () => pipingCalculation.InputParameters.ExitPointL = (RoundedDouble) valueToSet, - string.Format(Resources.PipingConfigurationImporter_ReadEntryExitPoint_Exit_point_invalid, valueToSet)); + () => pipingCalculation.InputParameters.ExitPointL = (RoundedDouble) exitPoint, + string.Format(Resources.PipingConfigurationImporter_ReadEntryExitPoint_Exit_point_invalid, exitPoint)); } } @@ -337,22 +338,42 @@ private static void ReadStochasts(ReadPipingCalculation readCalculation, PipingCalculationScenario pipingCalculation) { - if (readCalculation.DampingFactorExitMean.HasValue && readCalculation.DampingFactorExitStandardDeviation.HasValue) + if (readCalculation.PhreaticLevelExitMean.HasValue && readCalculation.PhreaticLevelExitStandardDeviation.HasValue) { - pipingCalculation.InputParameters.DampingFactorExit = new LogNormalDistribution - { - Mean = (RoundedDouble) readCalculation.DampingFactorExitMean, - StandardDeviation = (RoundedDouble) readCalculation.DampingFactorExitStandardDeviation - }; + var normalDistribution = new NormalDistribution(); + + var mean = (double) readCalculation.PhreaticLevelExitMean; + PerformActionHandlingAnyArgumentOutOfRangeException( + () => normalDistribution.Mean = (RoundedDouble) mean, + string.Format(Resources.PipingConfigurationImporter_ReadStochasts_Invalid_mean_0_for_stochast_with_name_1, mean, + PipingConfigurationSchemaIdentifiers.PhreaticLevelExitStochastName)); + + var standardDeviation = (double) readCalculation.PhreaticLevelExitStandardDeviation; + PerformActionHandlingAnyArgumentOutOfRangeException( + () => normalDistribution.StandardDeviation = (RoundedDouble) standardDeviation, + string.Format(Resources.PipingConfigurationImporter_ReadStochasts_Invalid_standard_deviation_0_for_stochast_with_name_1, mean, + PipingConfigurationSchemaIdentifiers.PhreaticLevelExitStochastName)); + + pipingCalculation.InputParameters.PhreaticLevelExit = normalDistribution; } - if (readCalculation.PhreaticLevelExitMean.HasValue && readCalculation.PhreaticLevelExitStandardDeviation.HasValue) + if (readCalculation.DampingFactorExitMean.HasValue && readCalculation.DampingFactorExitStandardDeviation.HasValue) { - pipingCalculation.InputParameters.PhreaticLevelExit = new NormalDistribution - { - Mean = (RoundedDouble) readCalculation.PhreaticLevelExitMean, - StandardDeviation = (RoundedDouble) readCalculation.PhreaticLevelExitStandardDeviation - }; + var logNormalDistribution = new LogNormalDistribution(); + + var mean = (double) readCalculation.DampingFactorExitMean; + PerformActionHandlingAnyArgumentOutOfRangeException( + () => logNormalDistribution.Mean = (RoundedDouble) mean, + string.Format(Resources.PipingConfigurationImporter_ReadStochasts_Invalid_mean_0_for_stochast_with_name_1, mean, + PipingConfigurationSchemaIdentifiers.DampingFactorExitStochastName)); + + var standardDeviation = (double) readCalculation.DampingFactorExitStandardDeviation; + PerformActionHandlingAnyArgumentOutOfRangeException( + () => logNormalDistribution.StandardDeviation = (RoundedDouble) standardDeviation, + string.Format(Resources.PipingConfigurationImporter_ReadStochasts_Invalid_standard_deviation_0_for_stochast_with_name_1, mean, + PipingConfigurationSchemaIdentifiers.DampingFactorExitStochastName)); + + pipingCalculation.InputParameters.DampingFactorExit = logNormalDistribution; } } Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs =================================================================== diff -u -r95c3b399555a6035f68d4d19fbbd32680895b67f -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 95c3b399555a6035f68d4d19fbbd32680895b67f) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -299,6 +299,26 @@ } /// + /// Looks up a localized string similar to Een gemiddelde van '{0}' is ongeldig voor stochast '{1}'.. + /// + public static string PipingConfigurationImporter_ReadStochasts_Invalid_mean_0_for_stochast_with_name_1 { + get { + return ResourceManager.GetString("PipingConfigurationImporter_ReadStochasts_Invalid_mean_0_for_stochast_with_name_1" + + "", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Een standaardafwijking van '{0}' is ongeldig voor stochast '{1}'.. + /// + public static string PipingConfigurationImporter_ReadStochasts_Invalid_standard_deviation_0_for_stochast_with_name_1 { + get { + return ResourceManager.GetString("PipingConfigurationImporter_ReadStochasts_Invalid_standard_deviation_0_for_stocha" + + "st_with_name_1", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De profielschematisatie '{0}' bestaat niet.. /// public static string PipingConfigurationImporter_ReadSurfaceLine_SurfaceLine_0_does_not_exist { Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx =================================================================== diff -u -r95c3b399555a6035f68d4d19fbbd32680895b67f -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision 95c3b399555a6035f68d4d19fbbd32680895b67f) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -331,4 +331,10 @@ Een waarde van '{0}' als uittredepunt is ongeldig. + + Een gemiddelde van '{0}' is ongeldig voor stochast '{1}'. + + + Een standaardafwijking van '{0}' is ongeldig voor stochast '{1}'. + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingConfigurationImporterTest.cs =================================================================== diff -u -r95c3b399555a6035f68d4d19fbbd32680895b67f -re03950c62ccfad90eefe8076d668767f69c90a8e --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingConfigurationImporterTest.cs (.../PipingConfigurationImporterTest.cs) (revision 95c3b399555a6035f68d4d19fbbd32680895b67f) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingConfigurationImporterTest.cs (.../PipingConfigurationImporterTest.cs) (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -175,6 +175,12 @@ "Een waarde van '200,2' als uittredepunt is ongeldig. Het gespecificeerde punt moet op het profiel liggen (bereik [0,0, 10,0]).")] [TestCase("validConfigurationEntryPointNotOnSurfaceLine.xml", "Een waarde van '-10' als intredepunt is ongeldig. Het gespecificeerde punt moet op het profiel liggen (bereik [0,0, 10,0]).")] + [TestCase("validConfigurationInvalidStandardDeviationPhreaticLevelExit.xml", + "Een standaardafwijking van '0' is ongeldig voor stochast 'polderpeil'. Standaardafwijking (σ) moet groter zijn dan of gelijk zijn aan 0.")] + [TestCase("validConfigurationInvalidMeanDampingFactorExit.xml", + "Een gemiddelde van '-1' is ongeldig voor stochast 'dempingsfactor'. Gemiddelde moet groter zijn dan 0.")] + [TestCase("validConfigurationInvalidStandardDeviationDampingFactorExit.xml", + "Een standaardafwijking van '1' is ongeldig voor stochast 'dempingsfactor'. Standaardafwijking (σ) moet groter zijn dan of gelijk zijn aan 0.")] public void Import_ValidConfigurationInvalidData_LogMessageAndContinueImport(string file, string expectedErrorMessage) { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidMeanDampingFactorExit.xml =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidMeanDampingFactorExit.xml (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidMeanDampingFactorExit.xml (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -0,0 +1,11 @@ + + + + + + -1 + 1 + + + + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidStandardDeviationDampingFactorExit.xml =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidStandardDeviationDampingFactorExit.xml (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidStandardDeviationDampingFactorExit.xml (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -0,0 +1,11 @@ + + + + + + 1 + -1 + + + + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidStandardDeviationPhreaticLevelExit.xml =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidStandardDeviationPhreaticLevelExit.xml (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/test-data/PipingConfigurationImporter/validConfigurationInvalidStandardDeviationPhreaticLevelExit.xml (revision e03950c62ccfad90eefe8076d668767f69c90a8e) @@ -0,0 +1,11 @@ + + + + + + 0 + -1 + + + + \ No newline at end of file