Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/StochasticSoilProfileProperties.cs =================================================================== diff -u -r0e57a86ea559f535e0128420d8c7076e06cd4f90 -r026b524685096af08e8adfd99406eab049506c3b --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/StochasticSoilProfileProperties.cs (.../StochasticSoilProfileProperties.cs) (revision 0e57a86ea559f535e0128420d8c7076e06cd4f90) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/StochasticSoilProfileProperties.cs (.../StochasticSoilProfileProperties.cs) (revision 026b524685096af08e8adfd99406eab049506c3b) @@ -21,7 +21,9 @@ using System; using System.ComponentModel; +using System.Globalization; using System.Linq; +using Core.Common.Base.Data; using Core.Common.Gui.Attributes; using Core.Common.Gui.Converters; using Core.Common.Gui.PropertyBag; @@ -54,11 +56,11 @@ [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "StochasticSoilProfile_Probability_DisplayName")] [ResourcesDescription(typeof(Resources), "StochasticSoilProfile_Probability_Description")] - public double Probability + public string Probability { get { - return data.Probability*100; + return new RoundedDouble(3, data.Probability*100).Value.ToString(CultureInfo.CurrentCulture); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/StochasticSoilProfilePropertiesTest.cs =================================================================== diff -u -r25d9f184b0a7bf99101d2ec0b1089ba2aeed9080 -r026b524685096af08e8adfd99406eab049506c3b --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/StochasticSoilProfilePropertiesTest.cs (.../StochasticSoilProfilePropertiesTest.cs) (revision 25d9f184b0a7bf99101d2ec0b1089ba2aeed9080) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/StochasticSoilProfilePropertiesTest.cs (.../StochasticSoilProfilePropertiesTest.cs) (revision 026b524685096af08e8adfd99406eab049506c3b) @@ -44,8 +44,27 @@ } [Test] - public void GetProperties_WithData_ReturnExpectedValues() + [TestCase(0.14, "14")] + [TestCase(1.0051, "100,51")] + [TestCase(0.5 + 1e-6, "50")] + [SetCulture("nl-NL")] + public void GetProperties_WithDataAndDutchLocale_ReturnExpectedValues(double probability, string expectedProbability) { + GetProperties_WithData_ReturnExpectedValues(probability, expectedProbability); + } + + [Test] + [TestCase(0.14, "14")] + [TestCase(1.0051, "100.51")] + [TestCase(0.5 + 1e-6, "50")] + [SetCulture("en-US")] + public void GetProperties_WithDataAndEnglishLocale_ReturnExpectedValues(double probability, string expectedProbability) + { + GetProperties_WithData_ReturnExpectedValues(probability, expectedProbability); + } + + private static void GetProperties_WithData_ReturnExpectedValues(double probability, string expectedProbability) + { // Setup const string expectedName = ""; IEnumerable layers = new[] @@ -58,7 +77,7 @@ }; var soilProfile = new PipingSoilProfile(expectedName, -5.0, layers, 0); - var stochasticSoilProfile = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 1234L) + var stochasticSoilProfile = new StochasticSoilProfile(probability, SoilProfileType.SoilProfile1D, 1234L) { SoilProfile = soilProfile }; @@ -74,7 +93,7 @@ Assert.AreEqual(expectedName, properties.ToString()); CollectionAssert.AreEqual(soilProfile.Layers.Select(l => l.Top), properties.TopLevels); Assert.AreEqual(soilProfile.Bottom, properties.Bottom); - Assert.AreEqual(stochasticSoilProfile.Probability*100, properties.Probability); + Assert.AreEqual(expectedProbability, properties.Probability); Assert.AreEqual("1D profiel", properties.Type); } }