Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsStochasticSoilProfileProperties.cs =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r7603662fcb3445b3b83461da1026334009c4c54c --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsStochasticSoilProfileProperties.cs (.../MacroStabilityInwardsStochasticSoilProfileProperties.cs) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsStochasticSoilProfileProperties.cs (.../MacroStabilityInwardsStochasticSoilProfileProperties.cs) (revision 7603662fcb3445b3b83461da1026334009c4c54c) @@ -75,11 +75,11 @@ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.StochasticSoilProfile_Probability_DisplayName))] [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.StochasticSoilProfile_Probability_Description))] - public string Probability + public RoundedDouble Probability { get { - return new RoundedDouble(3, data.Probability * 100).Value.ToString(CultureInfo.CurrentCulture); + return new RoundedDouble(2, data.Probability * 100); } } @@ -139,6 +139,7 @@ { return RingtoetsCommonFormsResources.StochasticSoilProfile_Type_1D; } + if (data.SoilProfile is MacroStabilityInwardsSoilProfile2D) { return RingtoetsCommonFormsResources.StochasticSoilProfile_Type_2D; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs =================================================================== diff -u -rc4392a12110e2bb3549c5fee1ec319c229b67198 -r7603662fcb3445b3b83461da1026334009c4c54c --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs (.../MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs) (revision c4392a12110e2bb3549c5fee1ec319c229b67198) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs (.../MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs) (revision 7603662fcb3445b3b83461da1026334009c4c54c) @@ -29,6 +29,7 @@ using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; @@ -73,43 +74,31 @@ } [Test] - [TestCase(0.142, "14,2")] - [TestCase(1.0, "100")] - [TestCase(0.5 + 1e-6, "50")] [SetCulture("nl-NL")] - public void GetProperties_WithSoilProfile1DAndDutchLocale_ReturnExpectedValues(double probability, string expectedProbability) + public void GetProperties_WithSoilProfile1DAndDutchLocale_ReturnExpectedValues() { - GetProperties_WithSoilProfile1D_ReturnExpectedValues(probability, expectedProbability); + GetProperties_WithSoilProfile1D_ReturnExpectedValues(0.54321); } [Test] - [TestCase(0.142, "14.2")] - [TestCase(1.0, "100")] - [TestCase(0.5 + 1e-6, "50")] [SetCulture("en-US")] - public void GetProperties_WithData1DAndEnglishLocale_ReturnExpectedValues(double probability, string expectedProbability) + public void GetProperties_WithData1DAndEnglishLocale_ReturnExpectedValues() { - GetProperties_WithSoilProfile1D_ReturnExpectedValues(probability, expectedProbability); + GetProperties_WithSoilProfile1D_ReturnExpectedValues(0.54321); } [Test] - [TestCase(0.142, "14,2")] - [TestCase(1.0, "100")] - [TestCase(0.5 + 1e-6, "50")] [SetCulture("nl-NL")] - public void GetProperties_WithSoilProfile2DAndDutchLocale_ReturnExpectedValues(double probability, string expectedProbability) + public void GetProperties_WithSoilProfile2DAndDutchLocale_ReturnExpectedValues() { - GetProperties_WithSoilProfile2D_ReturnExpectedValues(probability, expectedProbability); + GetProperties_WithSoilProfile2D_ReturnExpectedValues(0.54321); } [Test] - [TestCase(0.142, "14.2")] - [TestCase(1.0, "100")] - [TestCase(0.5 + 1e-6, "50")] [SetCulture("en-US")] - public void GetProperties_WithSoilProfile2DAndEnglishLocale_ReturnExpectedValues(double probability, string expectedProbability) + public void GetProperties_WithSoilProfile2DAndEnglishLocale_ReturnExpectedValues() { - GetProperties_WithSoilProfile2D_ReturnExpectedValues(probability, expectedProbability); + GetProperties_WithSoilProfile2D_ReturnExpectedValues(0.54321); } [Test] @@ -168,7 +157,6 @@ public void DynamicVisibleValidationMethod_AnyOtherProperty_ReturnsFalse() { // Setup - var soilProfile = new MacroStabilityInwardsSoilProfile1D("name", -5.0, new[] { new MacroStabilityInwardsSoilLayer1D(-2) @@ -309,7 +297,7 @@ Assert.AreEqual(expectedMessage, exception.Message); } - private static void GetProperties_WithSoilProfile1D_ReturnExpectedValues(double probability, string expectedProbability) + private static void GetProperties_WithSoilProfile1D_ReturnExpectedValues(double probability) { // Setup var layerOne = new MacroStabilityInwardsSoilLayer1D(-2); @@ -336,11 +324,12 @@ CollectionAssert.IsEmpty(properties.Layers2D); Assert.AreEqual(soilProfile.Bottom.ToString(CultureInfo.CurrentCulture), properties.Bottom); - Assert.AreEqual(expectedProbability, properties.Probability); + Assert.AreEqual(2, properties.Probability.NumberOfDecimalPlaces); + Assert.AreEqual(probability * 100, properties.Probability, properties.Probability.GetAccuracy()); Assert.AreEqual("1D profiel", properties.Type); } - private static void GetProperties_WithSoilProfile2D_ReturnExpectedValues(double probability, string expectedProbability) + private static void GetProperties_WithSoilProfile2D_ReturnExpectedValues(double probability) { // Setup MacroStabilityInwardsSoilLayer2D layerOne = CreateMacroStabilityInwardsSoilLayer2D(); @@ -372,8 +361,8 @@ CollectionAssert.IsEmpty(properties.Layers1D); Assert.AreEqual(double.NaN.ToString(CultureInfo.CurrentCulture), properties.Bottom); - - Assert.AreEqual(expectedProbability, properties.Probability); + Assert.AreEqual(2, properties.Probability.NumberOfDecimalPlaces); + Assert.AreEqual(probability * 100, properties.Probability, properties.Probability.GetAccuracy()); Assert.AreEqual("2D profiel", properties.Type); TestHelper.AssertTypeConverter