Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/GeneralClosingStructuresInput.cs =================================================================== diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/GeneralClosingStructuresInput.cs (.../GeneralClosingStructuresInput.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/GeneralClosingStructuresInput.cs (.../GeneralClosingStructuresInput.cs) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -31,6 +31,7 @@ /// public class GeneralClosingStructuresInput { + private static readonly Range validityRangeN2A = new Range(0, 40); private int n2A; /// @@ -93,9 +94,11 @@ } set { - if (value < 0 || value > 40) + if (!validityRangeN2A.InRange(value)) { - throw new ArgumentOutOfRangeException(nameof(value), Resources.N2A_Value_should_be_in_interval_0_40); + string message = string.Format(Resources.N2A_Value_should_be_in_Range_0_, + validityRangeN2A); + throw new ArgumentOutOfRangeException(nameof(value), message); } n2A = value; } @@ -108,7 +111,7 @@ { get { - return new RoundedDouble(2, Math.Max(1, C*N2A)); + return new RoundedDouble(2, Math.Max(1, C * N2A)); } } Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/Properties/Resources.Designer.cs =================================================================== diff -u -rc5e4c73210ba4412a7439e490e206822b5967c8c -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c5e4c73210ba4412a7439e490e206822b5967c8c) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -109,11 +109,11 @@ } /// - /// Looks up a localized string similar to De waarde voor 'N2A' moet in het bereik [0, 40] liggen.. + /// Looks up a localized string similar to De waarde voor 'N2A' moet in het bereik {0} liggen.. /// - public static string N2A_Value_should_be_in_interval_0_40 { + public static string N2A_Value_should_be_in_Range_0_ { get { - return ResourceManager.GetString("N2A_Value_should_be_in_interval_0_40", resourceCulture); + return ResourceManager.GetString("N2A_Value_should_be_in_Range_0_", resourceCulture); } } } Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/Properties/Resources.resx =================================================================== diff -u -rc5e4c73210ba4412a7439e490e206822b5967c8c -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/Properties/Resources.resx (.../Resources.resx) (revision c5e4c73210ba4412a7439e490e206822b5967c8c) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/Properties/Resources.resx (.../Resources.resx) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -126,7 +126,7 @@ Verticale wand - - De waarde voor 'N2A' moet in het bereik [0, 40] liggen. + + De waarde voor 'N2A' moet in het bereik {0} liggen. \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.Designer.cs =================================================================== diff -u -r7e53c08e25e9a9a730326f624be98008ddafbb7b -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7e53c08e25e9a9a730326f624be98008ddafbb7b) +++ Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -244,12 +244,12 @@ } /// - /// Looks up a localized string similar to De bijdrage van dit toetsspoor moet in het bereik [0, 1] liggen.. + /// Looks up a localized string similar to De bijdrage van dit toetsspoor moet in het bereik {0} liggen.. /// - public static string RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Contribution_must_be_in_interval_0_100 { + public static string RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Contribution_must_be_in_Range_0_ { get { return ResourceManager.GetString("RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Contribu" + - "tion_must_be_in_interval_0_100", resourceCulture); + "tion_must_be_in_Range_0_", resourceCulture); } } @@ -264,12 +264,12 @@ } /// - /// Looks up a localized string similar to De norm moet in het bereik [0, 1] liggen.. + /// Looks up a localized string similar to De norm moet in het bereik {0} liggen.. /// - public static string RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Norm_must_be_in_interval_0_1 { + public static string RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Norm_must_be_in_Range_0_ { get { return ResourceManager.GetString("RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Norm_mus" + - "t_be_in_interval_0_1", resourceCulture); + "t_be_in_Range_0_", resourceCulture); } } Index: Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.resx =================================================================== diff -u -r7e53c08e25e9a9a730326f624be98008ddafbb7b -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.resx (.../Resources.resx) (revision 7e53c08e25e9a9a730326f624be98008ddafbb7b) +++ Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.resx (.../Resources.resx) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -197,11 +197,11 @@ Er is geen hydraulische randvoorwaardendatabase geïmporteerd. - - De norm moet in het bereik [0, 1] liggen. + + De norm moet in het bereik {0} liggen. - - De bijdrage van dit toetsspoor moet in het bereik [0, 100] liggen. + + De bijdrage van dit toetsspoor moet in het bereik {0} liggen. De N-waarde van dit toetsspoor moet groter zijn dan 0. Index: Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataCalculationService.cs =================================================================== diff -u -rea797223dd831d567cbb669bb80f61c276e0b566 -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataCalculationService.cs (.../RingtoetsCommonDataCalculationService.cs) (revision ea797223dd831d567cbb669bb80f61c276e0b566) +++ Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataCalculationService.cs (.../RingtoetsCommonDataCalculationService.cs) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -20,6 +20,9 @@ // All rights reserved. using System; +using System.Globalization; +using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Utils; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Service.Properties; @@ -31,6 +34,9 @@ /// public static class RingtoetsCommonDataCalculationService { + private static readonly Range normValidityRange = new Range(0, 1); + private static readonly Range contributionValidityRange = new Range(0, 100); + /// /// Determines whether the calculated output is converged, /// based on the and the . @@ -62,16 +68,19 @@ /// public static double ProfileSpecificRequiredProbability(double norm, double failureMechanismContribution, int n) { - if (double.IsNaN(norm) || norm < 0.0 || norm > 1.0) + if (!normValidityRange.InRange(norm)) { - throw new ArgumentOutOfRangeException(nameof(norm), norm, - Resources.RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Norm_must_be_in_interval_0_1); + string message = string.Format(Resources.RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Norm_must_be_in_Range_0_, + normValidityRange.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture)); + throw new ArgumentOutOfRangeException(nameof(norm), norm, message); } - if (double.IsNaN(failureMechanismContribution) || failureMechanismContribution < 0 || failureMechanismContribution > 100) + if (!contributionValidityRange.InRange(failureMechanismContribution)) { + string message = string.Format(Resources.RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Contribution_must_be_in_Range_0_, + contributionValidityRange.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture)); throw new ArgumentOutOfRangeException(nameof(failureMechanismContribution), failureMechanismContribution, - Resources.RingtoetsCommonDataCalculationService_ProfileSpecificRequiredProbability_Contribution_must_be_in_interval_0_100); + message); } if (n <= 0) Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataCalculationServiceTest.cs =================================================================== diff -u -r0a185a7ccdc50bbfb5126f76e16c337b503c9705 -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataCalculationServiceTest.cs (.../RingtoetsCommonDataCalculationServiceTest.cs) (revision 0a185a7ccdc50bbfb5126f76e16c337b503c9705) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/RingtoetsCommonDataCalculationServiceTest.cs (.../RingtoetsCommonDataCalculationServiceTest.cs) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -74,6 +74,7 @@ } [Test] + [SetCulture("nl-NL")] public void ProfileSpecificRequiredProbability_WithInvalidNorm_ThrowsArgumentException( [Values(150, 1 + 1e-6, -1e-6, -150, double.NaN)] double norm) { @@ -88,11 +89,12 @@ ArgumentOutOfRangeException exception = Assert.Throws(action); Assert.AreEqual(norm, exception.ActualValue); Assert.AreEqual("norm", exception.ParamName); - StringAssert.StartsWith("De norm moet in het bereik [0, 1] liggen." + + StringAssert.StartsWith("De norm moet in het bereik [0,0, 1,0] liggen." + Environment.NewLine, exception.Message); } [Test] + [SetCulture("nl-NL")] public void ProfileSpecificRequiredProbability_WithInvalidFailureMechanismContribution_ThrowsArgumentException( [Values(150, 100 + 1e-6, -1e-6, -150, double.NaN)] double failureMechanismContribution) { @@ -107,7 +109,7 @@ ArgumentOutOfRangeException exception = Assert.Throws(action); Assert.AreEqual(failureMechanismContribution, exception.ActualValue); Assert.AreEqual("failureMechanismContribution", exception.ParamName); - StringAssert.StartsWith("De bijdrage van dit toetsspoor moet in het bereik [0, 100] liggen." + + StringAssert.StartsWith("De bijdrage van dit toetsspoor moet in het bereik [0,0, 100,0] liggen." + Environment.NewLine, exception.Message); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs =================================================================== diff -u -r11b25a9a8ba5c1fcadad1e32fa072e159aafff26 -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 11b25a9a8ba5c1fcadad1e32fa072e159aafff26) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -145,15 +145,6 @@ } /// - /// Looks up a localized string similar to Percentiel moet in het bereik [0, 1] liggen.. - /// - public static string DesignVariable_Percentile_must_be_in_range { - get { - return ResourceManager.GetString("DesignVariable_Percentile_must_be_in_range", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Geen lagen gevonden voor de ondergrondschematisatie.. /// public static string Error_Cannot_Construct_PipingSoilProfile_Without_Layers { @@ -172,11 +163,11 @@ } /// - /// Looks up a localized string similar to {0} De lokale coördinaat moet in het bereik [{1}, {2}] liggen.. + /// Looks up a localized string similar to {0} De lokale coördinaat moet in het bereik {1} liggen.. /// - public static string RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_1_2_range { + public static string RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_Range_1_ { get { - return ResourceManager.GetString("RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_1_2_range", resourceCulture); + return ResourceManager.GetString("RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_Range_1_", resourceCulture); } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx =================================================================== diff -u -r11b25a9a8ba5c1fcadad1e32fa072e159aafff26 -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 11b25a9a8ba5c1fcadad1e32fa072e159aafff26) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -120,9 +120,6 @@ Geen lagen gevonden voor de ondergrondschematisatie. - - Percentiel moet in het bereik [0, 1] liggen. - Een kansverdeling moet opgegeven zijn om op basis van die data een rekenwaarde te bepalen. @@ -135,8 +132,8 @@ De geometrie die opgegeven werd voor de profielschematisatie heeft geen waarde. - - {0} De lokale coördinaat moet in het bereik [{1}, {2}] liggen. + + {0} De lokale coördinaat moet in het bereik {1} liggen. De profielschematisatie heeft geen geometrie. Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -r34023112e9d57acf92ed6a713d6e2d1df8548098 -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 34023112e9d57acf92ed6a713d6e2d1df8548098) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Globalization; using System.Linq; using Core.Common.Base; using Core.Common.Base.Data; @@ -259,10 +260,10 @@ if (!ValidateInRange(l)) { - var outOfRangeMessage = string.Format(Resources.RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_1_2_range, + var localRangeL = new Range(LocalGeometry.First().X, LocalGeometry.Last().X); + var outOfRangeMessage = string.Format(Resources.RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_Range_1_, Resources.RingtoetsPipingSurfaceLine_GetZAtL_Cannot_determine_height, - LocalGeometry.First().X, - LocalGeometry.Last().X); + localRangeL.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture)); throw new ArgumentOutOfRangeException(null, outOfRangeMessage); } Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs =================================================================== diff -u -r34023112e9d57acf92ed6a713d6e2d1df8548098 -r18e230605af8cda1d527525691b2ba9597bf1464 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 34023112e9d57acf92ed6a713d6e2d1df8548098) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 18e230605af8cda1d527525691b2ba9597bf1464) @@ -263,6 +263,7 @@ } [Test] + [SetCulture("nl-NL")] [TestCase(-1)] [TestCase(-5e-3)] [TestCase(3.1 + 5e-3)] @@ -284,8 +285,7 @@ TestDelegate test = () => surfaceLine.GetZAtL((RoundedDouble) l); // Assert - var expectedMessage = string.Format("Kan geen hoogte bepalen. De lokale coördinaat moet in het bereik [0, {0}] liggen.", - 3.1); + const string expectedMessage = "Kan geen hoogte bepalen. De lokale coördinaat moet in het bereik [0,0, 3,1] liggen."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } @@ -747,7 +747,7 @@ var surfaceLine = new RingtoetsPipingSurfaceLine(); const string expectedName = "Other name"; - Point3D[] expectedGeometry = + Point3D[] expectedGeometry = { new Point3D(0, 1, 2), new Point3D(3, 4, 5),