Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingSemiProbabilisticOutputCreateExtensions.cs =================================================================== diff -u -ra2bfc1b408fe5187e5968cc2ff6ac7449211b537 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingSemiProbabilisticOutputCreateExtensions.cs (.../PipingSemiProbabilisticOutputCreateExtensions.cs) (revision a2bfc1b408fe5187e5968cc2ff6ac7449211b537) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingSemiProbabilisticOutputCreateExtensions.cs (.../PipingSemiProbabilisticOutputCreateExtensions.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -51,16 +51,16 @@ { UpliftFactorOfSafety = semiProbabilisticOutput.UpliftFactorOfSafety.Value.ToNullableDecimal(), UpliftReliability = semiProbabilisticOutput.UpliftReliability.Value.ToNullableDecimal(), - UpliftProbability = semiProbabilisticOutput.UpliftProbability.Value.ToNullableDecimal(), + UpliftProbability = semiProbabilisticOutput.UpliftProbability.ToNullableDecimal(), HeaveFactorOfSafety = semiProbabilisticOutput.HeaveFactorOfSafety.Value.ToNullableDecimal(), HeaveReliability = semiProbabilisticOutput.HeaveReliability.Value.ToNullableDecimal(), - HeaveProbability = semiProbabilisticOutput.HeaveProbability.Value.ToNullableDecimal(), + HeaveProbability = semiProbabilisticOutput.HeaveProbability.ToNullableDecimal(), SellmeijerFactorOfSafety = semiProbabilisticOutput.SellmeijerFactorOfSafety.Value.ToNullableDecimal(), SellmeijerReliability = semiProbabilisticOutput.SellmeijerReliability.Value.ToNullableDecimal(), - SellmeijerProbability = semiProbabilisticOutput.SellmeijerProbability.Value.ToNullableDecimal(), - RequiredProbability = semiProbabilisticOutput.RequiredProbability.Value.ToNullableDecimal(), + SellmeijerProbability = semiProbabilisticOutput.SellmeijerProbability.ToNullableDecimal(), + RequiredProbability = semiProbabilisticOutput.RequiredProbability.ToNullableDecimal(), RequiredReliability = semiProbabilisticOutput.RequiredReliability.Value.ToNullableDecimal(), - PipingProbability = semiProbabilisticOutput.PipingProbability.Value.ToNullableDecimal(), + PipingProbability = semiProbabilisticOutput.PipingProbability.ToNullableDecimal(), PipingReliability = semiProbabilisticOutput.PipingReliability.Value.ToNullableDecimal(), PipingFactorOfSafety = semiProbabilisticOutput.PipingFactorOfSafety.Value.ToNullableDecimal(), }; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs =================================================================== diff -u -r8a15fe6e429a0f177f25defaf1851c9963374dbe -rce94b8228bc7e51779b3754217580f13cb35e475 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -2301,7 +2301,7 @@ { PipingSemiProbabilisticOutputEntityId = storageId }; - var model = new PipingSemiProbabilisticOutput(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14); + var model = new PipingSemiProbabilisticOutput(1, 2, 0.3, 4, 5, 0.6, 7, 8, 0.9, 1.0, 11, 0.3, 13, 14); registry.Register(entity, model); // Call @@ -3400,8 +3400,8 @@ dbContext.PipingSemiProbabilisticOutputEntities.Add(orphanedEntity); dbContext.PipingSemiProbabilisticOutputEntities.Add(persistentEntity); - var pipingSemiProbabilisticOutput = new PipingSemiProbabilisticOutput(1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14) + var pipingSemiProbabilisticOutput = new PipingSemiProbabilisticOutput(1, 2, 0.3, 4, 5, 0.6, 7, + 8, 0.9, 1.0, 11, 0.3, 13, 14) { StorageId = persistentEntity.PipingSemiProbabilisticOutputEntityId }; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingCalculationScenarioCreateExtensionsTest.cs =================================================================== diff -u -r02937f67556a7b1d52477b196c62ed50df1cae6d -rce94b8228bc7e51779b3754217580f13cb35e475 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingCalculationScenarioCreateExtensionsTest.cs (.../PipingCalculationScenarioCreateExtensionsTest.cs) (revision 02937f67556a7b1d52477b196c62ed50df1cae6d) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingCalculationScenarioCreateExtensionsTest.cs (.../PipingCalculationScenarioCreateExtensionsTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -351,11 +351,11 @@ // Setup var registry = new PersistenceRegistry(); - var newOutput = new PipingSemiProbabilisticOutput(1, 2, 3, - 4, 5, 6, - 7, 8, 9, - 10, 11, - 12, 13, 14); + var newOutput = new PipingSemiProbabilisticOutput(1, 2, 0.3, + 4, 5, 0.6, + 7, 8, 0.9, + 1.0, 11, + 0.2, 13, 14); var calculation = new PipingCalculationScenario(new GeneralPipingInput()) { SemiProbabilisticOutput = newOutput Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingSemiProbabilisticOutputCreateExtensionsTest.cs =================================================================== diff -u -r02937f67556a7b1d52477b196c62ed50df1cae6d -rce94b8228bc7e51779b3754217580f13cb35e475 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingSemiProbabilisticOutputCreateExtensionsTest.cs (.../PipingSemiProbabilisticOutputCreateExtensionsTest.cs) (revision 02937f67556a7b1d52477b196c62ed50df1cae6d) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingSemiProbabilisticOutputCreateExtensionsTest.cs (.../PipingSemiProbabilisticOutputCreateExtensionsTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -40,8 +40,8 @@ public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException() { // Setup - var output = new PipingSemiProbabilisticOutput(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, - 8.8, 9.9, 10.10, 11.11, 12.12, + var output = new PipingSemiProbabilisticOutput(1.1, 2.2, 0.3, 4.4, 5.5, 0.6, 7.7, + 8.8, 0.9, 0.10, 11.11, 0.12, 13.13, 14.14); // Call @@ -56,8 +56,8 @@ public void Create_WithValidValues_ReturnEntity() { // Setup - var output = new PipingSemiProbabilisticOutput(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, - 8.8, 9.9, 10.10, 11.11, 12.12, + var output = new PipingSemiProbabilisticOutput(1.1, 2.2, 0.3, 4.4, 5.5, 0.6, 7.7, + 8.8, 0.9, 0.10, 11.11, 0.12, 13.13, 14.14); var registry = new PersistenceRegistry(); @@ -84,6 +84,15 @@ CollectionAssert.IsEmpty(entity.PipingCalculationEntities); } + private static void AssertAreEqual(double expectedValue, decimal? actualValue) + { + if (double.IsNaN(expectedValue)) + { + Assert.IsNull(actualValue); + } + Assert.AreEqual(expectedValue, Convert.ToDouble(actualValue)); + } + private static void AssertAreEqual(RoundedDouble expectedValue, decimal? actualValue) { if (double.IsNaN(expectedValue)) Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs =================================================================== diff -u -r450de34f5b9bea646121b6e101c849f9f78dfc51 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs (.../PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs) (revision 450de34f5b9bea646121b6e101c849f9f78dfc51) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs (.../PipingSemiProbabilisticOutputEntityReadExtensionsTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,18 +23,18 @@ { PipingSemiProbabilisticOutputEntityId = 5867, HeaveFactorOfSafety = 1.1m, - HeaveProbability = 2.2m, + HeaveProbability = 0.2m, HeaveReliability = 3.3m, PipingFactorOfSafety = 4.4m, - PipingProbability = 5.5m, + PipingProbability = 0.5m, PipingReliability = 6.6m, UpliftFactorOfSafety = 7.7m, - UpliftProbability = 8.8m, + UpliftProbability = 0.8m, UpliftReliability = 9.9m, SellmeijerFactorOfSafety = 10.10m, - SellmeijerProbability = 11.11m, + SellmeijerProbability = 0.11m, SellmeijerReliability = 12.12m, - RequiredProbability = 13.13m, + RequiredProbability = 0.13m, RequiredReliability = 14.14m }; @@ -103,6 +103,11 @@ Assert.IsNaN(pipingSemiProbabilisticOutput.RequiredReliability); } + private static void AssertAreEqual(decimal? expectedParamterValue, double actualParameterValue) + { + Assert.AreEqual(Convert.ToDouble(expectedParamterValue), actualParameterValue); + } + private static void AssertAreEqual(decimal? expectedParamterValue, RoundedDouble actualParameterValue) { Assert.AreEqual(Convert.ToDouble(expectedParamterValue), actualParameterValue, actualParameterValue.GetAccuracy()); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs =================================================================== diff -u -r8ed108b83f575f6cb7dc1b89224606894a4bcb7a -rce94b8228bc7e51779b3754217580f13cb35e475 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision 8ed108b83f575f6cb7dc1b89224606894a4bcb7a) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -148,11 +148,11 @@ } }, Output = new PipingOutput(1.1, 2.2, 3.3, 4.4, 5.5, 6.6), - SemiProbabilisticOutput = new PipingSemiProbabilisticOutput(7.7, 8.8, 9.9, - 10.10, 11.11, 12.12, - 13.13, 14.14, 15.15, - 16.16, 17.17, - 18.18, 19.19, 20.20) + SemiProbabilisticOutput = new PipingSemiProbabilisticOutput(7.7, 8.8, 0.9, + 10.10, 11.11, 0.12, + 13.13, 14.14, 0.15, + 0.16, 17.17, + 0.18, 19.19, 20.20) } } }); Index: Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs =================================================================== diff -u -r73aa6b5e849110e5c7cb584cce2aeb36698e7eee -rce94b8228bc7e51779b3754217580f13cb35e475 --- Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 73aa6b5e849110e5c7cb584cce2aeb36698e7eee) +++ Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -161,15 +161,6 @@ } /// - /// Looks up a localized string similar to 1/{0:n0}. - /// - public static string ProbabilityPerYearFormat { - get { - return ResourceManager.GetString("ProbabilityPerYearFormat", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Project. /// public static string Project_Constructor_Default_name { Index: Core/Common/src/Core.Common.Base/Properties/Resources.resx =================================================================== diff -u -r12a35732d53e73c149035a212f96d2a0e9604cff -rce94b8228bc7e51779b3754217580f13cb35e475 --- Core/Common/src/Core.Common.Base/Properties/Resources.resx (.../Resources.resx) (revision 12a35732d53e73c149035a212f96d2a0e9604cff) +++ Core/Common/src/Core.Common.Base/Properties/Resources.resx (.../Resources.resx) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -168,9 +168,6 @@ Vector moet 2 dimensies hebben, maar heeft er {0}. - - 1/{0:n0} - De tekst mag niet leeg zijn. Index: Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs (.../TypeUtils.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Core/Common/src/Core.Common.Utils/Reflection/TypeUtils.cs (.../TypeUtils.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; +using System.Linq; using System.Linq.Expressions; using System.Reflection; + using Core.Common.Utils.Properties; namespace Core.Common.Utils.Reflection @@ -83,21 +86,6 @@ return GetMemberName(expression, expression.Body); } - private static string GetMemberName(Expression originalExpression, Expression expressionBody) - { - try - { - return GetMemberNameFromExpression(expressionBody); - } - catch (ArgumentException) - { - var message = string.Format(Resources.TypeUtils_GetMemberName_0_is_not_a_valid_expression_for_this_method, - originalExpression); - throw new ArgumentException(message); - } - - } - /// /// Gets the value of a field of an instance. /// @@ -169,7 +157,7 @@ throw new ArgumentOutOfRangeException("methodName"); } - return (T) methodInfo.Invoke(instance, arguments); + return (T)methodInfo.Invoke(instance, arguments); } /// @@ -227,6 +215,52 @@ } /// + /// Determines whether a property is decorated with a + /// of a given type. + /// + /// The type of the target to retrieve the property from. + /// The type of to check + /// for on the property of . + /// The expression that resolves to the property to be checked. + /// True if the property is decorated with the given , + /// false otherwise. + /// When + /// is not an expression with a property, such as a expression calling multiple methods. + /// More then one property is found with + /// name specified in . + /// A custom attribute type cannot be loaded. + /// The property in + /// belongs to a type that is loaded into the reflection-only context. See How to: + /// Load Assemblies into the Reflection-Only Context on MSDN for more information. + public static bool HasTypeConverter(Expression> expression) where TTypeConverter : TypeConverter + { + var typeConverterAttributes = typeof(TTarget) + .GetProperty(GetMemberName(expression)) + .GetCustomAttributes(typeof(TypeConverterAttribute), false) + .OfType() + .ToArray(); + if (typeConverterAttributes.Length == 0) + { + return false; + } + return typeConverterAttributes[0].ConverterTypeName == typeof(TTypeConverter).AssemblyQualifiedName; + } + + private static string GetMemberName(Expression originalExpression, Expression expressionBody) + { + try + { + return GetMemberNameFromExpression(expressionBody); + } + catch (ArgumentException) + { + var message = string.Format(Resources.TypeUtils_GetMemberName_0_is_not_a_valid_expression_for_this_method, + originalExpression); + throw new ArgumentException(message); + } + } + + /// /// Returns the member name from the given . /// /// Index: Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs =================================================================== diff -u -rbde1064939627107ec7e5feab4d55566461d6267 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs (.../TypeUtilsTest.cs) (revision bde1064939627107ec7e5feab4d55566461d6267) +++ Core/Common/test/Core.Common.Utils.Test/Reflection/TypeUtilsTest.cs (.../TypeUtilsTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Reflection; using Core.Common.Utils.Reflection; @@ -128,7 +129,6 @@ Assert.AreEqual(22, privateIntValue); } - [Test] public void GetField_PrivateFieldOfDerivedClass_ReturnFieldValue() { @@ -384,6 +384,36 @@ Assert.Throws(call); } + [Test] + public void HasTypeConverter_PropertyWithoutTypeConverterAttribute_ReturnFalse() + { + // Call + bool hasTypeConverter = TypeUtils.HasTypeConverter(c => c.PublicPropertyPrivateSetter); + + // Assert + Assert.IsFalse(hasTypeConverter); + } + + [Test] + public void HasTypeConverter_PropertyWithDifferentTypeConverterAttribute_ReturnFalse() + { + // Call + bool hasTypeConverter = TypeUtils.HasTypeConverter(c => c.PropertyWithTypeConverter); + + // Assert + Assert.IsFalse(hasTypeConverter); + } + + [Test] + public void HasTypeConverter_PropertyWithMatchingTypeConverterAttribute_ReturnTrue() + { + // Call + bool hasTypeConverter = TypeUtils.HasTypeConverter(c => c.PropertyWithTypeConverter); + + // Assert + Assert.IsTrue(hasTypeConverter); + } + private class TestClass { /// @@ -405,6 +435,9 @@ public double PublicPropertyPrivateSetter { get; private set; } + [TypeConverter(typeof(DoubleConverter))] + public double PropertyWithTypeConverter { get; private set; } + /// /// Method used in reflection for tests above /// Index: Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/ICalculationScenario.cs =================================================================== diff -u -r209bfd7b71ef53a57e1a52337f1333d38122282f -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/ICalculationScenario.cs (.../ICalculationScenario.cs) (revision 209bfd7b71ef53a57e1a52337f1333d38122282f) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/ICalculationScenario.cs (.../ICalculationScenario.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -44,7 +44,7 @@ /// /// Implementers should throw /// when the getter is called while the does not return Done. - RoundedDouble Probability { get; } + double Probability { get; } /// /// Gets the status of the scenario. Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs =================================================================== diff -u -r95e76a7e90e94621a5e9773c2a365fa8e3b6dd31 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs (.../ProbabilityAssessmentOutput.cs) (revision 95e76a7e90e94621a5e9773c2a365fa8e3b6dd31) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentOutput.cs (.../ProbabilityAssessmentOutput.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -19,17 +19,25 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; + using Core.Common.Base; using Core.Common.Base.Data; + using Ringtoets.Common.Data.Calculation; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; + namespace Ringtoets.Common.Data.Probability { /// /// This class contains the results of a probabilistic assessment calculation. /// public class ProbabilityAssessmentOutput : Observable, ICalculationOutput { + private double requiredProbability; + private double probability; + /// /// Creates a new instance of . /// @@ -38,19 +46,41 @@ /// The probability of failure. /// The reliability of the failure mechanism. /// The factor of safety of the failure mechanism. + /// When setting a probability that falls + /// outside the [0.0, 1.0] range or isn't . public ProbabilityAssessmentOutput(double requiredProbability, double requiredReliability, double probability, double reliability, double factorOfSafety) { - RequiredProbability = new RoundedDouble(2, requiredProbability); + RequiredProbability = requiredProbability; RequiredReliability = new RoundedDouble(3, requiredReliability); - Probability = new RoundedDouble(2, probability); + Probability = probability; Reliability = new RoundedDouble(3, reliability); FactorOfSafety = new RoundedDouble(3, factorOfSafety); } /// /// Gets the required (maximum allowed) probability of failure. /// - public RoundedDouble RequiredProbability { get; private set; } + /// When setting a value that falls + /// outside the [0.0, 1.0] range or isn't . + public double RequiredProbability + { + get + { + return requiredProbability; + } + private set + { + if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) + { + requiredProbability = value; + } + else + { + throw new ArgumentOutOfRangeException("value", + RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); + } + } + } /// /// Get the required (maximum allowed) reliability of the failure mechanism. @@ -60,7 +90,27 @@ /// /// Gets the probability of failure. /// - public RoundedDouble Probability { get; private set; } + /// When setting a value that falls + /// outside the [0.0, 1.0] range or isn't . + public double Probability + { + get + { + return probability; + } + private set + { + if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) + { + probability = value; + } + else + { + throw new ArgumentOutOfRangeException("value", + RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); + } + } + } /// /// Gets the reliability of the failure mechanism. Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs =================================================================== diff -u -ra38844bb9c025b36f4639d7c6432eb3c7d1ee1c6 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a38844bb9c025b36f4639d7c6432eb3c7d1ee1c6) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -307,6 +307,15 @@ } /// + /// Looks up a localized string similar to Kans moet in het bereik [0, 1] opgegeven worden.. + /// + public static string Probability_Must_be_in_range_zero_to_one { + get { + return ResourceManager.GetString("Probability_Must_be_in_range_zero_to_one", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Referentielijn. /// public static string ReferenceLine_DisplayName { Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx =================================================================== diff -u -ra38844bb9c025b36f4639d7c6432eb3c7d1ee1c6 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision a38844bb9c025b36f4639d7c6432eb3c7d1ee1c6) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -213,4 +213,7 @@ Variatiecoëfficiënt moet groter zijn dan 0. + + Kans moet in het bereik [0, 1] opgegeven worden. + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/ProbabilityFormattingHelper.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/ProbabilityFormattingHelper.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/ProbabilityFormattingHelper.cs (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2016. 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 Ringtoets.Common.Forms.Properties; + +using CommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Ringtoets.Common.Forms.Helpers +{ + /// + /// This class helps in consistently writing the probability as '1 over the yearly return period'. + /// + public static class ProbabilityFormattingHelper + { + /// + /// Formats the specified probability. + /// + /// The probability. + /// The formatted text. + public static string Format(double probability) + { + if (probability.Equals(0.0)) + { + return string.Format(Resources.ProbabilityPerYearFormat, + CommonBaseResources.RoundedDouble_ToString_PositiveInfinity); + } + return string.Format(Resources.ProbabilityPerYearFormat, + 1.0 / probability); + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r0f7eb2998561112d0013b667ee39c2316341d2fe -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0f7eb2998561112d0013b667ee39c2316341d2fe) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -71,36 +71,6 @@ } /// - /// Looks up a localized string similar to De waarde voor toetslaag 2a kon niet geïnterpreteerd worden als een getal.. - /// - public static string ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value { - get { - return ResourceManager.GetString("ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_no" + - "t_parse_string_to_double_value", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to De waarde voor toetslaag 2a moet ingevuld zijn.. - /// - public static string ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null { - get { - return ResourceManager.GetString("ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_ca" + - "nnot_be_null", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to De waarde voor toetslaag 2a is te groot of te klein.. - /// - public static string ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large { - get { - return ResourceManager.GetString("ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_to" + - "o_large", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Be&rekenen. /// public static string Calculate { @@ -627,21 +597,21 @@ } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Looks up a localized string similar to -. /// - public static System.Drawing.Bitmap FailureMechanismSectionResultIcon { + public static string FailureMechanismSectionResult_No_result_dash { get { - object obj = ResourceManager.GetObject("FailureMechanismSectionResultIcon", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ResourceManager.GetString("FailureMechanismSectionResult_No_result_dash", resourceCulture); } } /// - /// Looks up a localized string similar to -. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// - public static string FailureMechanismSectionResultRow_AssessmentLayerTwoA_No_result_dash { + public static System.Drawing.Bitmap FailureMechanismSectionResultIcon { get { - return ResourceManager.GetString("FailureMechanismSectionResultRow_AssessmentLayerTwoA_No_result_dash", resourceCulture); + object obj = ResourceManager.GetObject("FailureMechanismSectionResultIcon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); } } @@ -931,6 +901,15 @@ } /// + /// Looks up a localized string similar to 1/{0:n0}. + /// + public static string ProbabilityPerYearFormat { + get { + return ResourceManager.GetString("ProbabilityPerYearFormat", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kan geen presentatie object maken voor een referentielijn zonder een traject als eigenaar.. /// public static string ReferenceLineContext_Parent_assessment_section_cannot_be_null { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r0f7eb2998561112d0013b667ee39c2316341d2fe -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0f7eb2998561112d0013b667ee39c2316341d2fe) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -262,7 +262,7 @@ Niet alle berekeningen voor dit vak hebben een geldige uitkomst. - + - @@ -325,15 +325,6 @@ ..\Resources\table.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - De waarde voor toetslaag 2a kon niet geïnterpreteerd worden als een getal. - - - De waarde voor toetslaag 2a is te groot of te klein. - - - De waarde voor toetslaag 2a moet ingevuld zijn. - De gemiddelde waarde van de lognormale verdeling. @@ -430,4 +421,7 @@ Hoogte [m+NAP] + + 1/{0:n0} + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ProbabilityAssessmentOutputProperties.cs =================================================================== diff -u -r7cfeb195650f713f29c53e9926499fa63e4c79ea -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ProbabilityAssessmentOutputProperties.cs (.../ProbabilityAssessmentOutputProperties.cs) (revision 7cfeb195650f713f29c53e9926499fa63e4c79ea) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ProbabilityAssessmentOutputProperties.cs (.../ProbabilityAssessmentOutputProperties.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -24,6 +24,7 @@ using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.Probability; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Properties; using CommonBaseResources = Core.Common.Base.Properties.Resources; @@ -42,7 +43,7 @@ { get { - return ToProbabilityFormat(data.RequiredProbability); + return ProbabilityFormattingHelper.Format(data.RequiredProbability); } } @@ -66,7 +67,7 @@ { get { - return ToProbabilityFormat(data.Probability); + return ProbabilityFormattingHelper.Format(data.Probability); } } @@ -93,10 +94,5 @@ return data.FactorOfSafety; } } - - private static string ToProbabilityFormat(RoundedDouble probability) - { - return string.Format(CommonBaseResources.ProbabilityPerYearFormat, probability); - } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -43,6 +43,7 @@ Properties\GlobalAssembly.cs + @@ -71,6 +72,8 @@ + + Index: Ringtoets/Common/src/Ringtoets.Common.Forms/TypeConverters/FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/TypeConverters/FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/TypeConverters/FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter.cs (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using System.Globalization; + +using Core.Common.Base.Data; + +using Ringtoets.Common.Forms.Helpers; + +using CommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Ringtoets.Common.Forms.TypeConverters +{ + /// + /// This class is a specialization of , + /// intended to display probabilities instead of just regular values. + /// + public class FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter : + FailureMechanismSectionResultNoValueRoundedDoubleConverter + { + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + var roundedDoubleValue = (RoundedDouble)value; + if (destinationType == typeof(string)) + { + if (!(double.IsNaN(roundedDoubleValue) || double.IsInfinity(roundedDoubleValue))) + { + return ProbabilityFormattingHelper.Format(roundedDoubleValue); + } + } + return base.ConvertTo(context, culture, value, destinationType); + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/TypeConverters/FailureMechanismSectionResultNoValueRoundedDoubleConverter.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/TypeConverters/FailureMechanismSectionResultNoValueRoundedDoubleConverter.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/TypeConverters/FailureMechanismSectionResultNoValueRoundedDoubleConverter.cs (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -0,0 +1,66 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using System.Globalization; + +using Core.Common.Base.Data; +using Core.Common.Base.TypeConverters; + +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.TypeConverters +{ + /// + /// This class is a more specialized implementation of + /// that is capable of converting or the - character + /// into . + /// + public class FailureMechanismSectionResultNoValueRoundedDoubleConverter : RoundedDoubleConverter + { + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + var text = value as string; + if (text != null) + { + if (string.IsNullOrWhiteSpace(text) || text.Trim() == Resources.FailureMechanismSectionResult_No_result_dash) + { + return (RoundedDouble)double.NaN; + } + } + return base.ConvertFrom(context, culture, value); + } + + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + var roundedDoubleValue = (RoundedDouble)value; + if (destinationType == typeof(string)) + { + if (double.IsNaN(roundedDoubleValue)) + { + return Resources.FailureMechanismSectionResult_No_result_dash; + } + } + return base.ConvertTo(context, culture, value, destinationType); + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Service/ProbabilityAssessmentService.cs =================================================================== diff -u -r120532d98cdfff11739f5df4d63f5521677876de -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/src/Ringtoets.Common.Service/ProbabilityAssessmentService.cs (.../ProbabilityAssessmentService.cs) (revision 120532d98cdfff11739f5df4d63f5521677876de) +++ Ringtoets/Common/src/Ringtoets.Common.Service/ProbabilityAssessmentService.cs (.../ProbabilityAssessmentService.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -45,9 +45,9 @@ var requiredReliability = ProbabilityToReliability(requiredProbability); var factorOfSafety = FactorOfSafety(reliability, requiredReliability); - return new ProbabilityAssessmentOutput(1/requiredProbability, + return new ProbabilityAssessmentOutput(requiredProbability, requiredReliability, - 1/probability, + probability, reliability, factorOfSafety); } Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentOutputTest.cs =================================================================== diff -u -r4c3daa6c52d8de89a58df080ea82b72b1855e534 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentOutputTest.cs (.../ProbabilityAssessmentOutputTest.cs) (revision 4c3daa6c52d8de89a58df080ea82b72b1855e534) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentOutputTest.cs (.../ProbabilityAssessmentOutputTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -22,6 +22,8 @@ using System; using Core.Common.Base; using Core.Common.Base.Data; +using Core.Common.TestUtil; + using NUnit.Framework; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Probability; @@ -36,9 +38,9 @@ { // Setup var random = new Random(5); - var requiredProbability = new RoundedDouble(2, random.NextDouble()); + var requiredProbability = random.NextDouble(); var requiredReliability = new RoundedDouble(3, random.NextDouble()); - var probability = new RoundedDouble(2, random.NextDouble()); + var probability = random.NextDouble(); var reliability = new RoundedDouble(3, random.NextDouble()); var factorOfSafety = new RoundedDouble(3, random.NextDouble()); @@ -55,5 +57,113 @@ Assert.AreEqual(reliability, output.Reliability); Assert.AreEqual(factorOfSafety, output.FactorOfSafety); } + + [Test] + [TestCase(double.NaN)] + [TestCase(0.0)] + [TestCase(0.123456789)] + [TestCase(1.0)] + public void RequiredProbability_SetToValidValue_GetValidValue(double requiredProbability) + { + // Setup + var random = new Random(5); + var requiredReliability = random.NextDouble(); + var probability = random.NextDouble(); + var reliability = random.NextDouble(); + var factorOfSafety = random.NextDouble(); + + // Call + var output = new ProbabilityAssessmentOutput(requiredProbability, + requiredReliability, + probability, + reliability, + factorOfSafety); + + // Assert + Assert.AreEqual(requiredProbability, output.RequiredProbability); + } + + [Test] + [TestCase(double.PositiveInfinity)] + [TestCase(double.NegativeInfinity)] + [TestCase(-1e-6)] + [TestCase(-346587.456)] + [TestCase(1.0 + 1e-6)] + [TestCase(346587.456)] + public void RequiredProbability_SetToInvalidValue_ThrowArgumentOutOfRangeException(double requiredProbability) + { + // Setup + var random = new Random(5); + var requiredReliability = random.NextDouble(); + var probability = random.NextDouble(); + var reliability = random.NextDouble(); + var factorOfSafety = random.NextDouble(); + + // Call + TestDelegate call = () => new ProbabilityAssessmentOutput(requiredProbability, + requiredReliability, + probability, + reliability, + factorOfSafety); + + // Assert + var expectedMessage = "Kans moet in het bereik [0, 1] opgegeven worden."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, + expectedMessage); + } + + [Test] + [TestCase(double.NaN)] + [TestCase(0.0)] + [TestCase(0.123456789)] + [TestCase(1.0)] + public void Probability_SetToValidValue_GetValidValue(double probability) + { + // Setup + var random = new Random(5); + var requiredProbability = random.NextDouble(); + var requiredReliability = random.NextDouble(); + var reliability = random.NextDouble(); + var factorOfSafety = random.NextDouble(); + + // Call + var output = new ProbabilityAssessmentOutput(requiredProbability, + requiredReliability, + probability, + reliability, + factorOfSafety); + + // Assert + Assert.AreEqual(requiredProbability, output.RequiredProbability); + } + + [Test] + [TestCase(double.PositiveInfinity)] + [TestCase(double.NegativeInfinity)] + [TestCase(-1e-6)] + [TestCase(-346587.456)] + [TestCase(1.0+1e-6)] + [TestCase(346587.456)] + public void Probability_SetToInvalidValue_ThrowArgumentOutOfRangeException(double probability) + { + // Setup + var random = new Random(5); + var requiredProbability = random.NextDouble(); + var requiredReliability = random.NextDouble(); + var reliability = random.NextDouble(); + var factorOfSafety = random.NextDouble(); + + // Call + TestDelegate call = () => new ProbabilityAssessmentOutput(requiredProbability, + requiredReliability, + probability, + reliability, + factorOfSafety); + + // Assert + var expectedMessage = "Kans moet in het bereik [0, 1] opgegeven worden."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, + expectedMessage); + } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/ProbabilityFormattingHelperTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/ProbabilityFormattingHelperTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/ProbabilityFormattingHelperTest.cs (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2016. 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 NUnit.Framework; + +using Ringtoets.Common.Forms.Helpers; + +namespace Ringtoets.Common.Forms.Test.Helpers +{ + [TestFixture] + public class ProbabilityFormattingHelperTest + { + [Test] + public void Format_ProbabilityIsZero_ReturnOneOverInfinity() + { + // Call + string text = ProbabilityFormattingHelper.Format(0); + + // Assert + Assert.AreEqual("1/Oneindig", text); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(1.0, "1/1")] + [TestCase(0.5, "1/2")] + [TestCase(0.6, "1/2")] + [TestCase(0.0001, "1/10.000")] + [TestCase(0.000000123456789, "1/8.100.000")] + public void Format_ProbabilityNotZero_ReturnOneOverReturnPeriod(double probability, string expectedText) + { + // Setup + + // Call + string text = ProbabilityFormattingHelper.Format(probability); + + // Assert + Assert.AreEqual(expectedText, text); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ProbabilityAssessmentOutputPropertiesTest.cs =================================================================== diff -u -r9ee17a39e4ba653cfc2e1a576f0ac53dcdf8a7dc -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ProbabilityAssessmentOutputPropertiesTest.cs (.../ProbabilityAssessmentOutputPropertiesTest.cs) (revision 9ee17a39e4ba653cfc2e1a576f0ac53dcdf8a7dc) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ProbabilityAssessmentOutputPropertiesTest.cs (.../ProbabilityAssessmentOutputPropertiesTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -47,10 +47,9 @@ { // Setup var random = new Random(22); - var bigFactor = 1000000; - double requiredProbability = random.NextDouble()*bigFactor; + double requiredProbability = random.NextDouble(); double requiredReliability = random.NextDouble(); - double probability = random.NextDouble()*bigFactor; + double probability = random.NextDouble(); double reliability = random.NextDouble(); double factorOfSafety = random.NextDouble(); @@ -64,39 +63,14 @@ // Assert var probabilityFormat = "1/{0:n0}"; - Assert.AreEqual(string.Format(probabilityFormat, requiredProbability), properties.RequiredProbability); + Assert.AreEqual(string.Format(probabilityFormat, 1.0/requiredProbability), properties.RequiredProbability); Assert.AreEqual(requiredReliability, properties.RequiredReliability, 1e-3); - Assert.AreEqual(string.Format(probabilityFormat, probability), properties.Probability); + Assert.AreEqual(string.Format(probabilityFormat, 1.0/probability), properties.Probability); Assert.AreEqual(reliability, properties.Reliability, 1e-3); Assert.AreEqual(factorOfSafety, properties.FactorOfSafety, 1e-3); } [Test] - public void GetProperties_WithInfinityValues_ReturnTranslatedFormat() - { - // Setup - var random = new Random(22); - double requiredProbability = double.PositiveInfinity; - double requiredReliability = random.NextDouble(); - double probability = double.PositiveInfinity; - double reliability = random.NextDouble(); - double factorOfSafety = random.NextDouble(); - - var output = new ProbabilityAssessmentOutput(requiredProbability, requiredReliability, probability, reliability, factorOfSafety); - - // Call - var properties = new ProbabilityAssessmentOutputProperties - { - Data = output - }; - - // Assert - var expectedProbabilityText = "1/Oneindig"; - Assert.AreEqual(expectedProbabilityText, properties.RequiredProbability); - Assert.AreEqual(expectedProbabilityText, properties.Probability); - } - - [Test] public void PropertyAttributes_ReturnExpectedValues() { // Setup Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r411b50528bbd83c02ffdcae699895529b2b34bf7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 411b50528bbd83c02ffdcae699895529b2b34bf7) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -58,6 +58,7 @@ + @@ -75,6 +76,8 @@ + + @@ -104,10 +107,6 @@ {f49bd8b2-332a-4c91-a196-8cce0a2c7d98} Core.Common.Utils - - {26214BD0-DAFB-4CFC-8EB2-80C5D53C859E} - Core.Common.Gui.TestUtil - {d749ee4c-ce50-4c17-bf01-9a953028c126} Core.Common.TestUtil @@ -116,10 +115,6 @@ {516EBC95-B8F2-428C-B7F6-733F01BF8FDD} Core.Components.Charting - - {C540E627-B95B-4CC0-A1B6-A0BDF74936C7} - Ringtoets.GrassCoverErosionInwards.Forms - {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TypeConverters/FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverterTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TypeConverters/FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverterTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TypeConverters/FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverterTest.cs (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -0,0 +1,194 @@ +// Copyright (C) Stichting Deltares 2016. 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.Globalization; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Forms.Helpers; +using Ringtoets.Common.Forms.TypeConverters; +using CommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Ringtoets.Common.Forms.Test.TypeConverters +{ + [TestFixture] + public class FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverterTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Assert + Assert.IsInstanceOf(converter); + } + + [Test] + [TestCase("")] + [TestCase(" ")] + [TestCase("-")] + [TestCase("NaN")] + public void ConvertFrom_NoValueText_ReturnNaN(string text) + { + // Setup + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Call + var result = (RoundedDouble)converter.ConvertFrom(text); + + // Assert + Assert.IsNaN(result.Value); + Assert.AreEqual(RoundedDouble.MaximumNumberOfDecimalPlaces, result.NumberOfDecimalPlaces); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(123.4567)] + [TestCase(-9.87654321)] + public void ConvertFrom_SomeNumericalTextInDutchCulture_ReturnConvertedRoundedDouble(double input) + { + DoConvertFrom_SomeNumericalTextInCurrentCulture_ReturnConvertedRoundedDouble(input); + } + + [Test] + [SetCulture("en-US")] + [TestCase(12.34)] + [TestCase(-0.96834715)] + public void ConvertFrom_SomeNumericalTextInEnglishCulture_ReturnConvertedRoundedDouble(double input) + { + DoConvertFrom_SomeNumericalTextInCurrentCulture_ReturnConvertedRoundedDouble(input); + } + + [Test] + public void ConvertFrom_TextDoesNotRepresentNumber_ThrowNotSupportedException() + { + // Setup + string text = "I'm not a number!"; + + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Call + TestDelegate call = () => converter.ConvertFrom(null, CultureInfo.CurrentCulture, text); + + // Assert + string message = Assert.Throws(call).Message; + Assert.AreEqual("De tekst moet een getal zijn.", message); + } + + [Test] + public void ConvertFrom_TextTooLongToStoreInDouble_ThrowNotSupportedException() + { + // Setup + string text = "1" + double.MaxValue.ToString(CultureInfo.CurrentCulture); + + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Call + TestDelegate call = () => converter.ConvertFrom(null, CultureInfo.CurrentCulture, text); + + // Assert + string message = Assert.Throws(call).Message; + Assert.AreEqual("De tekst is een getal dat te groot of te klein is om gerepresenteerd te worden.", message); + } + + [Test] + public void CanConvertTo_ToString_ReturnTrue() + { + // Setup + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Call + bool canConvertToString = converter.CanConvertTo(typeof(string)); + + // Assert + Assert.IsTrue(canConvertToString); + } + + [Test] + public void ConvertTo_NaNToString_ReturnHyphen() + { + // Setup + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Call + var text = (string)converter.ConvertTo((RoundedDouble)double.NaN, typeof(string)); + + // Assert + Assert.AreEqual("-", text); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(-0.000235)] + [TestCase(0.0069)] + public void ConvertTo_NumberToString_ReturnStringInLocalDutchCulture(double value) + { + // Setup + var roundedDouble = new RoundedDouble(8, value); + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Call + var text = (string)converter.ConvertTo(roundedDouble, typeof(string)); + + // Assert + string expectedText = ProbabilityFormattingHelper.Format(roundedDouble); + Assert.AreEqual(expectedText, text); + } + + [Test] + [SetCulture("en-US")] + [TestCase(-0.0000658)] + [TestCase(0.000006788)] + public void ConvertTo_NumberToString_ReturnStringInLocalEnglishCulture(double value) + { + // Setup + var roundedDouble = new RoundedDouble(8, value); + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Call + var text = (string)converter.ConvertTo(roundedDouble, typeof(string)); + + // Assert + string expectedText = ProbabilityFormattingHelper.Format(roundedDouble); + Assert.AreEqual(expectedText, text); + } + + private static void DoConvertFrom_SomeNumericalTextInCurrentCulture_ReturnConvertedRoundedDouble(double input) + { + // Setup + string text = input.ToString(CultureInfo.CurrentCulture); + + var converter = new FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter(); + + // Call + RoundedDouble conversionResult = (RoundedDouble)converter.ConvertFrom(null, CultureInfo.CurrentCulture, text); + + // Assert + Assert.IsNotNull(conversionResult); + Assert.AreEqual(RoundedDouble.MaximumNumberOfDecimalPlaces, conversionResult.NumberOfDecimalPlaces); + Assert.AreEqual(input, conversionResult.Value); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TypeConverters/FailureMechanismSectionResultNoValueRoundedDoubleConverterTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TypeConverters/FailureMechanismSectionResultNoValueRoundedDoubleConverterTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TypeConverters/FailureMechanismSectionResultNoValueRoundedDoubleConverterTest.cs (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -0,0 +1,191 @@ +// Copyright (C) Stichting Deltares 2016. 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.Globalization; + +using Core.Common.Base.Data; +using Core.Common.Base.TypeConverters; + +using NUnit.Framework; + +using Ringtoets.Common.Forms.TypeConverters; + +namespace Ringtoets.Common.Forms.Test.TypeConverters +{ + [TestFixture] + public class FailureMechanismSectionResultNoValueRoundedDoubleConverterTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Assert + Assert.IsInstanceOf(converter); + } + + [Test] + [TestCase("")] + [TestCase(" ")] + [TestCase("-")] + [TestCase("NaN")] + public void ConvertFrom_NoValueText_ReturnNaN(string text) + { + // Setup + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Call + var result = (RoundedDouble)converter.ConvertFrom(text); + + // Assert + Assert.IsNaN(result.Value); + Assert.AreEqual(RoundedDouble.MaximumNumberOfDecimalPlaces, result.NumberOfDecimalPlaces); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(123.4567)] + [TestCase(-9.87654321)] + public void ConvertFrom_SomeNumericalTextInDutchCulture_ReturnConvertedRoundedDouble(double input) + { + DoConvertFrom_SomeNumericalTextInCurrentCulture_ReturnConvertedRoundedDouble(input); + } + + [Test] + [SetCulture("en-US")] + [TestCase(12.34)] + [TestCase(-0.96834715)] + public void ConvertFrom_SomeNumericalTextInEnglishCulture_ReturnConvertedRoundedDouble(double input) + { + DoConvertFrom_SomeNumericalTextInCurrentCulture_ReturnConvertedRoundedDouble(input); + } + + [Test] + public void ConvertFrom_TextDoesNotRepresentNumber_ThrowNotSupportedException() + { + // Setup + string text = "I'm not a number!"; + + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Call + TestDelegate call = () => converter.ConvertFrom(null, CultureInfo.CurrentCulture, text); + + // Assert + string message = Assert.Throws(call).Message; + Assert.AreEqual("De tekst moet een getal zijn.", message); + } + + [Test] + public void ConvertFrom_TextTooLongToStoreInDouble_ThrowNotSupportedException() + { + // Setup + string text = "1" + double.MaxValue.ToString(CultureInfo.CurrentCulture); + + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Call + TestDelegate call = () => converter.ConvertFrom(null, CultureInfo.CurrentCulture, text); + + // Assert + string message = Assert.Throws(call).Message; + Assert.AreEqual("De tekst is een getal dat te groot of te klein is om gerepresenteerd te worden.", message); + } + + [Test] + public void CanConvertTo_ToString_ReturnTrue() + { + // Setup + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Call + bool canConvertToString = converter.CanConvertTo(typeof(string)); + + // Assert + Assert.IsTrue(canConvertToString); + } + + [Test] + public void ConvertTo_NaNToString_ReturnHyphen() + { + // Setup + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Call + var text = (string)converter.ConvertTo((RoundedDouble)double.NaN, typeof(string)); + + // Assert + Assert.AreEqual("-", text); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(-12.345)] + [TestCase(56.967)] + public void ConvertTo_NumberToString_ReturnStringInLocalDutchCulture(double value) + { + // Setup + var roundedDouble = new RoundedDouble(2, value); + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Call + var text = (string)converter.ConvertTo(roundedDouble, typeof(string)); + + // Assert + Assert.AreEqual(roundedDouble.ToString(), text); + } + + [Test] + [SetCulture("en-US")] + [TestCase(-67.891)] + [TestCase(23.346)] + public void ConvertTo_NumberToString_ReturnStringInLocalEnglishCulture(double value) + { + // Setup + var roundedDouble = new RoundedDouble(2, value); + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Call + var text = (string)converter.ConvertTo(roundedDouble, typeof(string)); + + // Assert + Assert.AreEqual(roundedDouble.ToString(), text); + } + + private static void DoConvertFrom_SomeNumericalTextInCurrentCulture_ReturnConvertedRoundedDouble(double input) + { + // Setup + string text = input.ToString(CultureInfo.CurrentCulture); + + var converter = new FailureMechanismSectionResultNoValueRoundedDoubleConverter(); + + // Call + RoundedDouble conversionResult = (RoundedDouble)converter.ConvertFrom(null, CultureInfo.CurrentCulture, text); + + // Assert + Assert.IsNotNull(conversionResult); + Assert.AreEqual(RoundedDouble.MaximumNumberOfDecimalPlaces, conversionResult.NumberOfDecimalPlaces); + Assert.AreEqual(input, conversionResult.Value); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/ProbabilityAssessmentServiceTest.cs =================================================================== diff -u -rbb0aeecc47206f5089ab04ca6c3575a1de8c206f -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/ProbabilityAssessmentServiceTest.cs (.../ProbabilityAssessmentServiceTest.cs) (revision bb0aeecc47206f5089ab04ca6c3575a1de8c206f) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/ProbabilityAssessmentServiceTest.cs (.../ProbabilityAssessmentServiceTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -28,21 +28,21 @@ public class ProbabilityAssessmentServiceTest { [Test] - [TestCase(30000, 100, 2, 60000)] - [TestCase(30000, 100, 1, 30000)] - [TestCase(30000, 24, 2, 250000)] - [TestCase(30000, 24, 1, 125000)] - [TestCase(20000, 100, 2, 40000)] - [TestCase(20000, 100, 1, 20000)] - [TestCase(20000, 24, 2, 166666.6667)] - [TestCase(20000, 24, 1, 83333.33)] + [TestCase(30000, 100, 2, 0.00001666667)] + [TestCase(30000, 100, 1, 0.00003333333)] + [TestCase(30000, 24, 2, 0.00000400000)] + [TestCase(30000, 24, 1, 0.00000800000)] + [TestCase(20000, 100, 2, 0.00002500000)] + [TestCase(20000, 100, 1, 0.00005000000)] + [TestCase(20000, 24, 2, 0.00000600000)] + [TestCase(20000, 24, 1, 0.00001200000)] public void RequiredProbability_DifferentInputs_ReturnsExpectedValue(int norm, double contribution, int lengthEffectN, double expectedResult) { // Call var probabilityAssessmentOutput = ProbabilityAssessmentService.Calculate(norm, contribution, lengthEffectN, double.NaN); // Assert - Assert.AreEqual(expectedResult, probabilityAssessmentOutput.RequiredProbability, probabilityAssessmentOutput.RequiredProbability.GetAccuracy()); + Assert.AreEqual(expectedResult, probabilityAssessmentOutput.RequiredProbability, 1e-6); } [Test] @@ -76,15 +76,15 @@ } [Test] - [TestCase(4, 31574.3855346)] - [TestCase(5, 3488555.78723)] + [TestCase(4, 0.00003167124)] + [TestCase(5, 0.00000028665)] public void Probability_DifferentInputs_ReturnsExpectedValue(double reliability, double expectedResult) { // Call var probabilityAssessmentOutput = ProbabilityAssessmentService.Calculate(int.MinValue, double.NaN, double.NaN, reliability); // Assert - Assert.AreEqual(expectedResult, probabilityAssessmentOutput.Probability, probabilityAssessmentOutput.Probability.GetAccuracy()); + Assert.AreEqual(expectedResult, probabilityAssessmentOutput.Probability, 1e-6); } [Test] Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs =================================================================== diff -u -rfa2a0dff6598123689fc7a69745440215879a243 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResult.cs) (revision fa2a0dff6598123689fc7a69745440215879a243) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -40,7 +40,10 @@ /// The to get the result from. /// Thrown when is null. public GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) - { } + { + assessmentLayerTwoA = (RoundedDouble)double.NaN; + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets the value of assessment layer two a. Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj =================================================================== diff -u -rfa2a0dff6598123689fc7a69745440215879a243 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision fa2a0dff6598123689fc7a69745440215879a243) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -34,10 +34,8 @@ - - Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs =================================================================== diff -u -rf5a2d607a5b8053b232c1f3ad572a0acba6a4e3a -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs) (revision f5a2d607a5b8053b232c1f3ad572a0acba6a4e3a) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,7 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.GrassCoverErosionInwards.Data; namespace Ringtoets.GrassCoverErosionInwards.Forms.Views @@ -79,6 +83,7 @@ /// /// Gets the value representing the result of the layer 2a assessment. /// + [TypeConverter(typeof(FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerTwoA { get @@ -90,6 +95,7 @@ /// /// Gets or sets the value representing the result of the layer 3 assessment. /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs =================================================================== diff -u -ra64de6ae2156a0977bec63ec48825d185dba2801 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision a64de6ae2156a0977bec63ec48825d185dba2801) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -157,7 +157,7 @@ public void GetObservableOutput_Always_ReturnsOutput() { // Setup - var output = new ProbabilityAssessmentOutput(2.0, 3.0, 1.4, 50.3, 16.3); + var output = new ProbabilityAssessmentOutput(0.2, 3.0, 0.4, 50.3, 16.3); var calculation = new GrassCoverErosionInwardsCalculation { Output = output Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs =================================================================== diff -u -r1cd3618f5f8916ef15992d69ec3b447b311c2f72 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs) (revision 1cd3618f5f8916ef15992d69ec3b447b311c2f72) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -55,8 +55,8 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); - Assert.AreEqual(0, result.AssessmentLayerTwoA.Value); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerTwoA); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -r5150f97d1c5e019d39723b22ff200e48b2112e71 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision 5150f97d1c5e019d39723b22ff200e48b2112e71) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -157,19 +157,20 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.IsFalse((bool)cells[assessmentLayerOneIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); cells = rows[1].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); Assert.IsFalse((bool)cells[assessmentLayerOneIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); } } [Test] + [SetCulture("nl-NL")] [TestCase(true)] [TestCase(false)] public void FailureMechanismResultsView_ChangeCheckBox_DataGridViewCorrectlySyncedAndStylingSet(bool checkBoxSelected) @@ -192,8 +193,8 @@ var cellAssessmentLayerThree = cells[assessmentLayerThreeIndex]; Assert.AreEqual(checkBoxSelected, (bool)cells[assessmentLayerOneIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cellAssessmentLayerTwoA.FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cellAssessmentLayerThree.FormattedValue); + Assert.AreEqual("-", cellAssessmentLayerTwoA.FormattedValue); + Assert.AreEqual("-", cellAssessmentLayerThree.FormattedValue); var cellAssessmentLayerTwoABackColor = cellAssessmentLayerTwoA.Style.BackColor; var cellAssessmentLayerTwoAForeColor = cellAssessmentLayerTwoA.Style.ForeColor; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rbd3056331b8727d6f9758d1f4e5979694d439398 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs) (revision bd3056331b8727d6f9758d1f4e5979694d439398) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,12 +23,15 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Forms.Views; @@ -63,6 +66,13 @@ Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerTwoA)); + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -290,9 +290,9 @@ // Assert Assert.AreEqual((RoundedDouble) 0.625, calculation.Output.FactorOfSafety); - Assert.AreEqual((RoundedDouble) 382.04, calculation.Output.Probability); + Assert.AreEqual(0.0026175033274158377, calculation.Output.Probability); Assert.AreEqual((RoundedDouble) 2.792, calculation.Output.Reliability); - Assert.AreEqual((RoundedDouble) 250000.00, calculation.Output.RequiredProbability); + Assert.AreEqual(1.0/250000.0, calculation.Output.RequiredProbability); Assert.AreEqual((RoundedDouble) 4.465, calculation.Output.RequiredReliability); mocks.VerifyAll(); } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResult.cs =================================================================== diff -u -r0868d78756c7992a83a096f3d3759046c2dbb217 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResult.cs (.../HeightStructuresFailureMechanismSectionResult.cs) (revision 0868d78756c7992a83a096f3d3759046c2dbb217) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResult.cs (.../HeightStructuresFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -39,7 +39,11 @@ /// /// The to get the result from. /// Thrown when is null. - public HeightStructuresFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public HeightStructuresFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + assessmentLayerTwoA = (RoundedDouble)double.NaN; + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets the value of assessment layer two a. Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs =================================================================== diff -u -rb4b7570863a54297e406e5c604b5e7fb64681db4 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs (.../HeightStructuresInput.cs) (revision b4b7570863a54297e406e5c604b5e7fb64681db4) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs (.../HeightStructuresInput.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -44,14 +44,14 @@ private readonly LogNormalDistribution stormDuration; private RoundedDouble orientationOfTheNormalOfTheStructure; private RoundedDouble deviationOfTheWaveDirection; - private RoundedDouble failureProbabilityOfStructureGivenErosion; + private double failureProbabilityOfStructureGivenErosion; /// /// Creates a new instance of the class. /// public HeightStructuresInput() { - failureProbabilityOfStructureGivenErosion = (RoundedDouble) 1; + failureProbabilityOfStructureGivenErosion = 1.0; levelOfCrestOfStructure = new NormalDistribution(2) { @@ -263,7 +263,7 @@ /// Gets or sets the failure probability of structure given erosion. /// /// Thrown when is not in range [0, 1]. - public RoundedDouble FailureProbabilityOfStructureGivenErosion + public double FailureProbabilityOfStructureGivenErosion { get { Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs =================================================================== diff -u -rb4b7570863a54297e406e5c604b5e7fb64681db4 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs (.../HeightStructuresInputContextProperties.cs) (revision b4b7570863a54297e406e5c604b5e7fb64681db4) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresInputContextProperties.cs (.../HeightStructuresInputContextProperties.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -27,6 +27,8 @@ using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; + +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.PresentationObjects; @@ -83,12 +85,6 @@ return data.AvailableHydraulicBoundaryLocations; } - private static string ToProbabilityFormat(RoundedDouble probability) - { - var d = (RoundedDouble) (1/probability); - return string.Format(CoreCommonBasePropertiesResources.ProbabilityPerYearFormat, d); - } - #region Schematisation [PropertyOrder(orientationOfTheNormalOfTheStructurePropertyIndex)] @@ -212,7 +208,7 @@ { get { - return ToProbabilityFormat(data.WrappedData.FailureProbabilityOfStructureGivenErosion); + return ProbabilityFormattingHelper.Format(data.WrappedData.FailureProbabilityOfStructureGivenErosion); } set { Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs =================================================================== diff -u -r5150f97d1c5e019d39723b22ff200e48b2112e71 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision 5150f97d1c5e019d39723b22ff200e48b2112e71) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.HeightStructures.Data; namespace Ringtoets.HeightStructures.Forms.Views @@ -77,6 +80,7 @@ /// /// Gets the assessment layer two a of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerTwoA { get @@ -88,6 +92,7 @@ /// /// Gets or sets the assessment layer three of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs =================================================================== diff -u -rb4b7570863a54297e406e5c604b5e7fb64681db4 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs (.../HeightStructuresCalculationTest.cs) (revision b4b7570863a54297e406e5c604b5e7fb64681db4) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresCalculationTest.cs (.../HeightStructuresCalculationTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -154,8 +154,7 @@ Assert.AreEqual(18, inputParameters.WidthOfFlowApertures.Mean.Value); Assert.AreEqual(2, inputParameters.DeviationOfTheWaveDirection.NumberOfDecimalPlaces); Assert.AreEqual(0.0, inputParameters.DeviationOfTheWaveDirection.Value); - Assert.AreEqual(RoundedDouble.MaximumNumberOfDecimalPlaces, inputParameters.FailureProbabilityOfStructureGivenErosion.NumberOfDecimalPlaces); - Assert.AreEqual(1, inputParameters.FailureProbabilityOfStructureGivenErosion.Value); + Assert.AreEqual(1, inputParameters.FailureProbabilityOfStructureGivenErosion); } private class TestHeightStructuresOutput : ProbabilityAssessmentOutput Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultTest.cs =================================================================== diff -u -r1cd3618f5f8916ef15992d69ec3b447b311c2f72 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultTest.cs (.../HeightStructuresFailureMechanismSectionResultTest.cs) (revision 1cd3618f5f8916ef15992d69ec3b447b311c2f72) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultTest.cs (.../HeightStructuresFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -45,8 +45,8 @@ Assert.IsInstanceOf(sectionResult); Assert.AreSame(section, sectionResult.Section); Assert.IsFalse(sectionResult.AssessmentLayerOne); - Assert.AreEqual(0, sectionResult.AssessmentLayerTwoA.Value); - Assert.AreEqual(0, sectionResult.AssessmentLayerThree.Value); + Assert.IsNaN(sectionResult.AssessmentLayerTwoA); + Assert.IsNaN(sectionResult.AssessmentLayerThree); Assert.AreEqual(0, sectionResult.StorageId); } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs =================================================================== diff -u -rb4b7570863a54297e406e5c604b5e7fb64681db4 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision b4b7570863a54297e406e5c604b5e7fb64681db4) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -263,10 +263,10 @@ var input = new HeightStructuresInput(); // Call - input.FailureProbabilityOfStructureGivenErosion = (RoundedDouble)failureProbabilityOfStructureGivenErosion; + input.FailureProbabilityOfStructureGivenErosion = failureProbabilityOfStructureGivenErosion; // Assert - AssertAreEqual(failureProbabilityOfStructureGivenErosion, input.FailureProbabilityOfStructureGivenErosion); + Assert.AreEqual(failureProbabilityOfStructureGivenErosion, input.FailureProbabilityOfStructureGivenErosion); } [Test] Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs =================================================================== diff -u -r780026d643daa908175ea55cf553a33ae1d8f634 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision 780026d643daa908175ea55cf553a33ae1d8f634) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -29,7 +29,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.PresentationObjects; @@ -124,8 +124,7 @@ }; AssertLogNormalDistributionVariationProperties(criticalOvertoppingDischargeProperties, properties.CriticalOvertoppingDischarge); - var expectedFailureProbabilityOfStructureGivenErosion = string.Format(CoreCommonBasePropertiesResources.ProbabilityPerYearFormat, - input.FailureProbabilityOfStructureGivenErosion); + var expectedFailureProbabilityOfStructureGivenErosion = ProbabilityFormattingHelper.Format(input.FailureProbabilityOfStructureGivenErosion); Assert.AreEqual(expectedFailureProbabilityOfStructureGivenErosion, properties.FailureProbabilityOfStructureGivenErosion); Assert.AreEqual(input.HydraulicBoundaryLocation, properties.HydraulicBoundaryLocation); @@ -171,7 +170,7 @@ // Assert Assert.AreEqual(newOrientationOfTheNormalOfTheStructure, properties.OrientationOfTheNormalOfTheStructure); - Assert.AreEqual(0.01, input.FailureProbabilityOfStructureGivenErosion, input.FailureProbabilityOfStructureGivenErosion.GetAccuracy()); + Assert.AreEqual(0.01, input.FailureProbabilityOfStructureGivenErosion); Assert.AreEqual("1/100", properties.FailureProbabilityOfStructureGivenErosion); Assert.AreSame(hydraulicBoundaryLocation, properties.HydraulicBoundaryLocation); mockRepository.VerifyAll(); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -r5150f97d1c5e019d39723b22ff200e48b2112e71 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision 5150f97d1c5e019d39723b22ff200e48b2112e71) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -157,15 +157,15 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.IsFalse((bool)cells[assessmentLayerOneIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); cells = rows[1].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); Assert.IsFalse((bool)cells[assessmentLayerOneIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); } } @@ -192,8 +192,8 @@ var cellAssessmentLayerThree = cells[assessmentLayerThreeIndex]; Assert.AreEqual(checkBoxSelected, (bool)cells[assessmentLayerOneIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cellAssessmentLayerTwoA.FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cellAssessmentLayerThree.FormattedValue); + Assert.AreEqual("-", cellAssessmentLayerTwoA.FormattedValue); + Assert.AreEqual("-", cellAssessmentLayerThree.FormattedValue); var cellAssessmentLayerTwoABackColor = cellAssessmentLayerTwoA.Style.BackColor; var cellAssessmentLayerTwoAForeColor = cellAssessmentLayerTwoA.Style.ForeColor; Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rbd3056331b8727d6f9758d1f4e5979694d439398 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs (.../HeightStructuresFailureMechanismSectionResultRowTest.cs) (revision bd3056331b8727d6f9758d1f4e5979694d439398) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs (.../HeightStructuresFailureMechanismSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,12 +23,15 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.Views; @@ -63,6 +66,13 @@ Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerTwoA)); + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj (.../Ringtoets.Integration.Data.csproj) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj (.../Ringtoets.Integration.Data.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -84,26 +84,20 @@ Core.Common.Base False - - {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} - Core.Common.Utils - False - {c90b77da-e421-43cc-b82e-529651bc21ac} Core.Common.Version False - - {318BA582-88C9-4816-A54A-A7E431461DE3} - Core.Components.Gis - False - {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data False + + {4d840673-3812-4338-a352-84854e32b8a0} + Ringtoets.Common.Forms + {90DE728E-48EF-4665-AB38-3D88E41D9F4D} Ringtoets.GrassCoverErosionInwards.Data Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/ClosingStructureFailureMechanismSectionResult.cs =================================================================== diff -u -rd5dfad7e2e7b86747c393ffc9a82d774d7649a57 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/ClosingStructureFailureMechanismSectionResult.cs (.../ClosingStructureFailureMechanismSectionResult.cs) (revision d5dfad7e2e7b86747c393ffc9a82d774d7649a57) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/ClosingStructureFailureMechanismSectionResult.cs (.../ClosingStructureFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -44,7 +44,8 @@ public ClosingStructureFailureMechanismSectionResult(FailureMechanismSection section) : base(section) { - AssessmentLayerTwoA = (RoundedDouble) 1.0; + AssessmentLayerTwoA = (RoundedDouble) double.NaN; + AssessmentLayerThree = (RoundedDouble)double.NaN; } /// Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/DuneErosionFailureMechanismSectionResult.cs =================================================================== diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/DuneErosionFailureMechanismSectionResult.cs (.../DuneErosionFailureMechanismSectionResult.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/DuneErosionFailureMechanismSectionResult.cs (.../DuneErosionFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public DuneErosionFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public DuneErosionFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value of the detailed assessment of safety per failure mechanism section, for which Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverErosionOutwardsFailureMechanismSectionResult.cs =================================================================== diff -u -r4a12b47ea94488f0716d7c61c6cefba235d7db48 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverErosionOutwardsFailureMechanismSectionResult.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResult.cs) (revision 4a12b47ea94488f0716d7c61c6cefba235d7db48) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverErosionOutwardsFailureMechanismSectionResult.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public GrassCoverErosionOutwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public GrassCoverErosionOutwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverSlipOffInwardsFailureMechanismSectionResult.cs =================================================================== diff -u -r0e4717786f2f1a865e48da9fde2089a789bfe02c -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverSlipOffInwardsFailureMechanismSectionResult.cs (.../GrassCoverSlipOffInwardsFailureMechanismSectionResult.cs) (revision 0e4717786f2f1a865e48da9fde2089a789bfe02c) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverSlipOffInwardsFailureMechanismSectionResult.cs (.../GrassCoverSlipOffInwardsFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public GrassCoverSlipOffInwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public GrassCoverSlipOffInwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverSlipOffOutwardsFailureMechanismSectionResult.cs =================================================================== diff -u -r0e4717786f2f1a865e48da9fde2089a789bfe02c -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverSlipOffOutwardsFailureMechanismSectionResult.cs (.../GrassCoverSlipOffOutwardsFailureMechanismSectionResult.cs) (revision 0e4717786f2f1a865e48da9fde2089a789bfe02c) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/GrassCoverSlipOffOutwardsFailureMechanismSectionResult.cs (.../GrassCoverSlipOffOutwardsFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public GrassCoverSlipOffOutwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public GrassCoverSlipOffOutwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacrostabilityInwardsFailureMechanismSectionResult.cs =================================================================== diff -u -rd5dfad7e2e7b86747c393ffc9a82d774d7649a57 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacrostabilityInwardsFailureMechanismSectionResult.cs (.../MacrostabilityInwardsFailureMechanismSectionResult.cs) (revision d5dfad7e2e7b86747c393ffc9a82d774d7649a57) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacrostabilityInwardsFailureMechanismSectionResult.cs (.../MacrostabilityInwardsFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -44,7 +44,8 @@ public MacrostabilityInwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) { - AssessmentLayerTwoA = (RoundedDouble)1.0; + AssessmentLayerTwoA = (RoundedDouble)double.NaN; + AssessmentLayerThree = (RoundedDouble)double.NaN; } /// Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacrostabilityOutwardsFailureMechanismSectionResult.cs =================================================================== diff -u -rd5dfad7e2e7b86747c393ffc9a82d774d7649a57 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacrostabilityOutwardsFailureMechanismSectionResult.cs (.../MacrostabilityOutwardsFailureMechanismSectionResult.cs) (revision d5dfad7e2e7b86747c393ffc9a82d774d7649a57) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacrostabilityOutwardsFailureMechanismSectionResult.cs (.../MacrostabilityOutwardsFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -44,7 +44,8 @@ public MacrostabilityOutwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) { - AssessmentLayerTwoA = (RoundedDouble)1.0; + AssessmentLayerTwoA = (RoundedDouble)double.NaN; + AssessmentLayerThree = (RoundedDouble)double.NaN; } /// Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MicrostabilityFailureMechanismSectionResult.cs =================================================================== diff -u -r0e4717786f2f1a865e48da9fde2089a789bfe02c -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MicrostabilityFailureMechanismSectionResult.cs (.../MicrostabilityFailureMechanismSectionResult.cs) (revision 0e4717786f2f1a865e48da9fde2089a789bfe02c) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MicrostabilityFailureMechanismSectionResult.cs (.../MicrostabilityFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,9 +20,12 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Core.Common.Base.Storage; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; namespace Ringtoets.Integration.Data.StandAlone.SectionResults { @@ -38,7 +41,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public MicrostabilityFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public MicrostabilityFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. @@ -54,6 +60,7 @@ /// /// Gets or sets the value of the tailored assessment of safety. /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get; set; } public long StorageId { get; set; } Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/PipingStructureFailureMechanismSectionResult.cs =================================================================== diff -u -r0e4717786f2f1a865e48da9fde2089a789bfe02c -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/PipingStructureFailureMechanismSectionResult.cs (.../PipingStructureFailureMechanismSectionResult.cs) (revision 0e4717786f2f1a865e48da9fde2089a789bfe02c) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/PipingStructureFailureMechanismSectionResult.cs (.../PipingStructureFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public PipingStructureFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public PipingStructureFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StabilityStoneCoverFailureMechanismSectionResult.cs =================================================================== diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StabilityStoneCoverFailureMechanismSectionResult.cs (.../StabilityStoneCoverFailureMechanismSectionResult.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StabilityStoneCoverFailureMechanismSectionResult.cs (.../StabilityStoneCoverFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public StabilityStoneCoverFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public StabilityStoneCoverFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value of the detailed assessment of safety per failure mechanism section, for which Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult.cs =================================================================== diff -u -rebad637e9483d348a5efe2fe902d56aa91bf6a31 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult.cs) (revision ebad637e9483d348a5efe2fe902d56aa91bf6a31) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResult.cs =================================================================== diff -u -rd5dfad7e2e7b86747c393ffc9a82d774d7649a57 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResult.cs (.../StrengthStabilityPointConstructionFailureMechanismSectionResult.cs) (revision d5dfad7e2e7b86747c393ffc9a82d774d7649a57) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResult.cs (.../StrengthStabilityPointConstructionFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -44,7 +44,8 @@ public StrengthStabilityPointConstructionFailureMechanismSectionResult(FailureMechanismSection section) : base(section) { - AssessmentLayerTwoA = (RoundedDouble)1.0; + AssessmentLayerTwoA = (RoundedDouble)double.NaN; + AssessmentLayerThree = (RoundedDouble)double.NaN; } /// Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/TechnicalInnovationFailureMechanismSectionResult.cs =================================================================== diff -u -r2fe46c62134fde70ada240fa952971444177be90 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/TechnicalInnovationFailureMechanismSectionResult.cs (.../TechnicalInnovationFailureMechanismSectionResult.cs) (revision 2fe46c62134fde70ada240fa952971444177be90) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/TechnicalInnovationFailureMechanismSectionResult.cs (.../TechnicalInnovationFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public TechnicalInnovationFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public TechnicalInnovationFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/WaterPressureAsphaltCoverFailureMechanismSectionResult.cs =================================================================== diff -u -r2fe46c62134fde70ada240fa952971444177be90 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/WaterPressureAsphaltCoverFailureMechanismSectionResult.cs (.../WaterPressureAsphaltCoverFailureMechanismSectionResult.cs) (revision 2fe46c62134fde70ada240fa952971444177be90) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/WaterPressureAsphaltCoverFailureMechanismSectionResult.cs (.../WaterPressureAsphaltCoverFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,10 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public WaterPressureAsphaltCoverFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public WaterPressureAsphaltCoverFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/WaveImpactAsphaltCoverFailureMechanismSectionResult.cs =================================================================== diff -u -rb4816e19c7167c26fad825b88dd72b59dcedc13a -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/WaveImpactAsphaltCoverFailureMechanismSectionResult.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResult.cs) (revision b4816e19c7167c26fad825b88dd72b59dcedc13a) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/WaveImpactAsphaltCoverFailureMechanismSectionResult.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,11 @@ /// The for which the /// will hold the result. /// Thrown when is null. - public WaveImpactAsphaltCoverFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public WaveImpactAsphaltCoverFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerTwoA = (RoundedDouble)double.NaN; + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value representing whether the simple assessment of safety passed. Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r61849787ccd3c614e8ad17e2bf78a69aeb50d3f6 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 61849787ccd3c614e8ad17e2bf78a69aeb50d3f6) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -35,10 +35,8 @@ - - Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/ClosingStructureSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/ClosingStructureSectionResultRow.cs (.../ClosingStructureSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/ClosingStructureSectionResultRow.cs (.../ClosingStructureSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,12 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Core.Common.Base.Properties; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -58,44 +62,25 @@ /// /// Gets or sets the value representing the result of the . /// - /// Thrown when is null. - /// Thrown when either: - /// - /// is not in the range [0,1]. - /// doesn't represent a value which can be parsed to a double value. - /// - /// - public string AssessmentLayerTwoA + /// Thrown when is + /// not in the range [0,1]. + [TypeConverter(typeof(FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter))] + public RoundedDouble AssessmentLayerTwoA { get { - var d = (RoundedDouble) (1/SectionResult.AssessmentLayerTwoA); - return string.Format(Resources.ProbabilityPerYearFormat, d); + return SectionResult.AssessmentLayerTwoA; } set { - if (value == null) - { - throw new ArgumentNullException("value",Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null); - } - try - { - SectionResult.AssessmentLayerTwoA = (RoundedDouble) double.Parse(value); - } - catch (OverflowException) - { - throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large); - } - catch (FormatException) - { - throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value); - } + SectionResult.AssessmentLayerTwoA = value; } } /// - /// Gets or sets the value representing the result of the . + /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/DuneErosionSectionResultRow.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/DuneErosionSectionResultRow.cs (.../DuneErosionSectionResultRow.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/DuneErosionSectionResultRow.cs (.../DuneErosionSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -55,8 +58,9 @@ } /// - /// Gets or sets the value representing the result of the . + /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverErosionOutwardsSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverErosionOutwardsSectionResultRow.cs (.../GrassCoverErosionOutwardsSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverErosionOutwardsSectionResultRow.cs (.../GrassCoverErosionOutwardsSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -73,6 +76,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRow.cs (.../GrassCoverSlipOffInwardsSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRow.cs (.../GrassCoverSlipOffInwardsSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -73,6 +76,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRow.cs (.../GrassCoverSlipOffOutwardsSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRow.cs (.../GrassCoverSlipOffOutwardsSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -73,6 +76,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacrostabilityInwardsSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacrostabilityInwardsSectionResultRow.cs (.../MacrostabilityInwardsSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacrostabilityInwardsSectionResultRow.cs (.../MacrostabilityInwardsSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,12 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Core.Common.Base.Properties; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -58,44 +62,25 @@ /// /// Gets or sets the value representing the result of the . /// - /// Thrown when is null. - /// Thrown when either: - /// - /// is not in the range [0,1]. - /// doesn't represent a value which can be parsed to a double value. - /// - /// - public string AssessmentLayerTwoA + /// Thrown when is + /// not in the range [0,1]. + [TypeConverter(typeof(FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter))] + public RoundedDouble AssessmentLayerTwoA { get { - var d = (RoundedDouble) (1/SectionResult.AssessmentLayerTwoA); - return string.Format(Resources.ProbabilityPerYearFormat, d); + return SectionResult.AssessmentLayerTwoA; } set { - if (value == null) - { - throw new ArgumentNullException("value",Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null); - } - try - { - SectionResult.AssessmentLayerTwoA = (RoundedDouble) double.Parse(value); - } - catch (OverflowException) - { - throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large); - } - catch (FormatException) - { - throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value); - } + SectionResult.AssessmentLayerTwoA = value; } } /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacrostabilityOutwardsSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacrostabilityOutwardsSectionResultRow.cs (.../MacrostabilityOutwardsSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacrostabilityOutwardsSectionResultRow.cs (.../MacrostabilityOutwardsSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,12 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Core.Common.Base.Properties; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -58,44 +62,25 @@ /// /// Gets or sets the value representing the result of the . /// - /// Thrown when is null. - /// Thrown when either: - /// - /// is not in the range [0,1]. - /// doesn't represent a value which can be parsed to a double value. - /// - /// - public string AssessmentLayerTwoA + /// Thrown when is + /// not in the range [0,1]. + [TypeConverter(typeof(FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter))] + public RoundedDouble AssessmentLayerTwoA { get { - var d = (RoundedDouble) (1/SectionResult.AssessmentLayerTwoA); - return string.Format(Resources.ProbabilityPerYearFormat, d); + return SectionResult.AssessmentLayerTwoA; } set { - if (value == null) - { - throw new ArgumentNullException("value",Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null); - } - try - { - SectionResult.AssessmentLayerTwoA = (RoundedDouble) double.Parse(value); - } - catch (OverflowException) - { - throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large); - } - catch (FormatException) - { - throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value); - } + SectionResult.AssessmentLayerTwoA = value; } } /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MicrostabilitySectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MicrostabilitySectionResultRow.cs (.../MicrostabilitySectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MicrostabilitySectionResultRow.cs (.../MicrostabilitySectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,14 +20,18 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows { /// - /// Class for displaying as a row in a grid view. + /// Class for displaying + /// as a row in a grid view. /// public class MicrostabilitySectionResultRow : FailureMechanismSectionResultRow { @@ -73,6 +77,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/PipingStructureSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/PipingStructureSectionResultRow.cs (.../PipingStructureSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/PipingStructureSectionResultRow.cs (.../PipingStructureSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -73,6 +76,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StabilityStoneCoverSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StabilityStoneCoverSectionResultRow.cs (.../StabilityStoneCoverSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StabilityStoneCoverSectionResultRow.cs (.../StabilityStoneCoverSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -57,6 +60,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRow.cs (.../StrengthStabilityLengthwiseConstructionSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRow.cs (.../StrengthStabilityLengthwiseConstructionSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,7 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -57,6 +61,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StrengthStabilityPointConstructionSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StrengthStabilityPointConstructionSectionResultRow.cs (.../StrengthStabilityPointConstructionSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/StrengthStabilityPointConstructionSectionResultRow.cs (.../StrengthStabilityPointConstructionSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,8 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; -using Core.Common.Base.Properties; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -42,44 +45,25 @@ /// /// Gets or sets the value representing the result of the . /// - /// Thrown when is null. - /// Thrown when either: - /// - /// is not in the range [0,1]. - /// doesn't represent a value which can be parsed to a double value. - /// - /// - public string AssessmentLayerTwoA + /// Thrown when is + /// not in the range [0,1]. + [TypeConverter(typeof(FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter))] + public RoundedDouble AssessmentLayerTwoA { get { - var d = (RoundedDouble) (1/SectionResult.AssessmentLayerTwoA); - return string.Format(Resources.ProbabilityPerYearFormat, d); + return SectionResult.AssessmentLayerTwoA; } set { - if (value == null) - { - throw new ArgumentNullException("value",Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null); - } - try - { - SectionResult.AssessmentLayerTwoA = (RoundedDouble) double.Parse(value); - } - catch (OverflowException) - { - throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large); - } - catch (FormatException) - { - throw new ArgumentException(Common.Forms.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value); - } + SectionResult.AssessmentLayerTwoA = value; } } /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/TechnicalInnovationSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/TechnicalInnovationSectionResultRow.cs (.../TechnicalInnovationSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/TechnicalInnovationSectionResultRow.cs (.../TechnicalInnovationSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,7 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -57,6 +61,7 @@ /// /// Gets or sets the value representing the result of the .. /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRow.cs (.../WaterPressureAsphaltCoverSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRow.cs (.../WaterPressureAsphaltCoverSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,7 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -57,6 +61,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/WaveImpactAsphaltCoverSectionResultRow.cs =================================================================== diff -u -r99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/WaveImpactAsphaltCoverSectionResultRow.cs (.../WaveImpactAsphaltCoverSectionResultRow.cs) (revision 99aa5c56c58f8dddcb76b9d0e2f2f5ec4cd38e56) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/WaveImpactAsphaltCoverSectionResultRow.cs (.../WaveImpactAsphaltCoverSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -20,7 +20,11 @@ // All rights reserved. using System; +using System.ComponentModel; + using Core.Common.Base.Data; + +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Ringtoets.Integration.Forms.Views.SectionResultRows @@ -57,6 +61,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerTwoA { get @@ -72,6 +77,7 @@ /// /// Gets or sets the value representing the result of the . /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj (.../Ringtoets.Integration.Data.Test.csproj) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj (.../Ringtoets.Integration.Data.Test.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -44,12 +44,8 @@ ..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll True - - ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll - - @@ -90,26 +86,6 @@ {3bbfd65b-b277-4e50-ae6d-bd24c3434609} Core.Common.Base - - {9a2d67e6-26ac-4d17-b11a-2b4372f2f572} - Core.Common.Controls - - - {D749EE4C-CE50-4C17-BF01-9A953028C126} - Core.Common.TestUtil - - - {5A91174A-FB95-4C9D-9CA5-81C0B8D4361A} - Core.Components.DotSpatial.Forms - - - {318ba582-88c9-4816-a54a-a7e431461de3} - Core.Components.Gis - - - {610E0A9C-1997-4C43-A10E-39D4C66ADA93} - Core.Plugins.DotSpatial - {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data @@ -118,10 +94,6 @@ {1c0017d8-35b5-4ca0-8fc7-a83f46dbdc99} Ringtoets.HeightStructures.Data - - {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2} - Ringtoets.HydraRing.Data - {90de728e-48ef-4665-ab38-3d88e41d9f4d} Ringtoets.GrassCoverErosionInwards.Data @@ -131,7 +103,7 @@ Ringtoets.Piping.Data - {14C6F716-64E2-4BC4-A1EF-05865FCEFA4C} + {14c6f716-64e2-4bc4-a1ef-05865fcefa4c} Ringtoets.Piping.Primitives Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/ClosingStructureFailureMechanismSectionResultTest.cs =================================================================== diff -u -r1cd3618f5f8916ef15992d69ec3b447b311c2f72 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/ClosingStructureFailureMechanismSectionResultTest.cs (.../ClosingStructureFailureMechanismSectionResultTest.cs) (revision 1cd3618f5f8916ef15992d69ec3b447b311c2f72) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/ClosingStructureFailureMechanismSectionResultTest.cs (.../ClosingStructureFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -57,8 +57,8 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); - Assert.AreEqual(1, result.AssessmentLayerTwoA.Value); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerTwoA); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/DuneErosionFailureMechanismSectionResultTest.cs =================================================================== diff -u -re88fa1dfcf62085f7fabc453b73dbc8ac3ff9223 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/DuneErosionFailureMechanismSectionResultTest.cs (.../DuneErosionFailureMechanismSectionResultTest.cs) (revision e88fa1dfcf62085f7fabc453b73dbc8ac3ff9223) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/DuneErosionFailureMechanismSectionResultTest.cs (.../DuneErosionFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -59,7 +59,7 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.AreEqual(AssessmentLayerTwoAResult.NotCalculated, result.AssessmentLayerTwoA); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverErosionOutwardsFailureMechanismSectionResultTest.cs =================================================================== diff -u -re88fa1dfcf62085f7fabc453b73dbc8ac3ff9223 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverErosionOutwardsFailureMechanismSectionResultTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultTest.cs) (revision e88fa1dfcf62085f7fabc453b73dbc8ac3ff9223) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverErosionOutwardsFailureMechanismSectionResultTest.cs (.../GrassCoverErosionOutwardsFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -60,7 +60,7 @@ Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); Assert.AreEqual(AssessmentLayerTwoAResult.NotCalculated, result.AssessmentLayerTwoA); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverSlipOffInwardsFailureMechanismSectionResultTest.cs =================================================================== diff -u -re88fa1dfcf62085f7fabc453b73dbc8ac3ff9223 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverSlipOffInwardsFailureMechanismSectionResultTest.cs (.../GrassCoverSlipOffInwardsFailureMechanismSectionResultTest.cs) (revision e88fa1dfcf62085f7fabc453b73dbc8ac3ff9223) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverSlipOffInwardsFailureMechanismSectionResultTest.cs (.../GrassCoverSlipOffInwardsFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -60,7 +60,7 @@ Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); Assert.AreEqual(AssessmentLayerTwoAResult.NotCalculated, result.AssessmentLayerTwoA); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverSlipOffOutwardsFailureMechanismSectionResultTest.cs =================================================================== diff -u -re88fa1dfcf62085f7fabc453b73dbc8ac3ff9223 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverSlipOffOutwardsFailureMechanismSectionResultTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismSectionResultTest.cs) (revision e88fa1dfcf62085f7fabc453b73dbc8ac3ff9223) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/GrassCoverSlipOffOutwardsFailureMechanismSectionResultTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -60,7 +60,7 @@ Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); Assert.AreEqual(AssessmentLayerTwoAResult.NotCalculated, result.AssessmentLayerTwoA); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacrostabilityInwardsFailureMechanismSectionResultTest.cs =================================================================== diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacrostabilityInwardsFailureMechanismSectionResultTest.cs (.../MacrostabilityInwardsFailureMechanismSectionResultTest.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacrostabilityInwardsFailureMechanismSectionResultTest.cs (.../MacrostabilityInwardsFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -57,8 +57,8 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); - Assert.AreEqual(1, result.AssessmentLayerTwoA.Value); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerTwoA); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacrostabilityOutwardsFailureMechanismSectionResultTest.cs =================================================================== diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacrostabilityOutwardsFailureMechanismSectionResultTest.cs (.../MacrostabilityOutwardsFailureMechanismSectionResultTest.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacrostabilityOutwardsFailureMechanismSectionResultTest.cs (.../MacrostabilityOutwardsFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -57,8 +57,8 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); - Assert.AreEqual(1, result.AssessmentLayerTwoA.Value); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerTwoA); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MicrostabilityFailureMechanismSectionResultTest.cs =================================================================== diff -u -re88fa1dfcf62085f7fabc453b73dbc8ac3ff9223 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MicrostabilityFailureMechanismSectionResultTest.cs (.../MicrostabilityFailureMechanismSectionResultTest.cs) (revision e88fa1dfcf62085f7fabc453b73dbc8ac3ff9223) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MicrostabilityFailureMechanismSectionResultTest.cs (.../MicrostabilityFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -60,7 +60,7 @@ Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); Assert.AreEqual(AssessmentLayerTwoAResult.NotCalculated, result.AssessmentLayerTwoA); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree.Value); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/PipingStructureFailureMechanismSectionResultTest.cs =================================================================== diff -u -re88fa1dfcf62085f7fabc453b73dbc8ac3ff9223 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/PipingStructureFailureMechanismSectionResultTest.cs (.../PipingStructureFailureMechanismSectionResultTest.cs) (revision e88fa1dfcf62085f7fabc453b73dbc8ac3ff9223) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/PipingStructureFailureMechanismSectionResultTest.cs (.../PipingStructureFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -60,7 +60,7 @@ Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); Assert.AreEqual(AssessmentLayerTwoAResult.NotCalculated, result.AssessmentLayerTwoA); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StabilityStoneCoverFailureMechanismSectionResultTest.cs =================================================================== diff -u -re88fa1dfcf62085f7fabc453b73dbc8ac3ff9223 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StabilityStoneCoverFailureMechanismSectionResultTest.cs (.../StabilityStoneCoverFailureMechanismSectionResultTest.cs) (revision e88fa1dfcf62085f7fabc453b73dbc8ac3ff9223) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StabilityStoneCoverFailureMechanismSectionResultTest.cs (.../StabilityStoneCoverFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -59,7 +59,7 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.AreEqual(AssessmentLayerTwoAResult.NotCalculated, result.AssessmentLayerTwoA); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree.Value); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultTest.cs =================================================================== diff -u -r1cd3618f5f8916ef15992d69ec3b447b311c2f72 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultTest.cs) (revision 1cd3618f5f8916ef15992d69ec3b447b311c2f72) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -56,7 +56,7 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs =================================================================== diff -u -r8a15fe6e429a0f177f25defaf1851c9963374dbe -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs (.../StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs (.../StrengthStabilityPointConstructionFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -56,8 +56,8 @@ Assert.IsInstanceOf(result); Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); - Assert.AreEqual(1, result.AssessmentLayerTwoA.Value); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerTwoA); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/TechnicalInnovationFailureMechanismSectionResultTest.cs =================================================================== diff -u -r1cd3618f5f8916ef15992d69ec3b447b311c2f72 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/TechnicalInnovationFailureMechanismSectionResultTest.cs (.../TechnicalInnovationFailureMechanismSectionResultTest.cs) (revision 1cd3618f5f8916ef15992d69ec3b447b311c2f72) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/TechnicalInnovationFailureMechanismSectionResultTest.cs (.../TechnicalInnovationFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -59,7 +59,7 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/WaterPressureAsphaltCoverFailureMechanismSectionResultTest.cs =================================================================== diff -u -r1cd3618f5f8916ef15992d69ec3b447b311c2f72 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/WaterPressureAsphaltCoverFailureMechanismSectionResultTest.cs (.../WaterPressureAsphaltCoverFailureMechanismSectionResultTest.cs) (revision 1cd3618f5f8916ef15992d69ec3b447b311c2f72) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/WaterPressureAsphaltCoverFailureMechanismSectionResultTest.cs (.../WaterPressureAsphaltCoverFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -56,7 +56,7 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/WaveImpactAsphaltCoverFailureMechanismSectionResultTest.cs =================================================================== diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/WaveImpactAsphaltCoverFailureMechanismSectionResultTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultTest.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/WaveImpactAsphaltCoverFailureMechanismSectionResultTest.cs (.../WaveImpactAsphaltCoverFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -56,8 +56,8 @@ Assert.IsInstanceOf(result); Assert.AreSame(section, result.Section); Assert.IsFalse(result.AssessmentLayerOne); - Assert.AreEqual(0, result.AssessmentLayerTwoA.Value); - Assert.AreEqual(0, result.AssessmentLayerThree.Value); + Assert.IsNaN(result.AssessmentLayerTwoA); + Assert.IsNaN(result.AssessmentLayerThree); Assert.AreEqual(0, result.StorageId); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r61849787ccd3c614e8ad17e2bf78a69aeb50d3f6 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 61849787ccd3c614e8ad17e2bf78a69aeb50d3f6) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -194,10 +194,6 @@ {F0BCF06A-3D01-4D65-A249-E2A14AEC6EFD} Ringtoets.HeightStructures.Forms - - {888d4097-8bc2-4703-9fb1-8744c94d525e} - Ringtoets.HydraRing.Calculation - {70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2} Ringtoets.HydraRing.Data Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/ClosingStructureSectionResultRowTest.cs =================================================================== diff -u -rbd3056331b8727d6f9758d1f4e5979694d439398 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/ClosingStructureSectionResultRowTest.cs (.../ClosingStructureSectionResultRowTest.cs) (revision bd3056331b8727d6f9758d1f4e5979694d439398) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/ClosingStructureSectionResultRowTest.cs (.../ClosingStructureSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,17 +23,19 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; -using Core.Common.TestUtil; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; -using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.Integration.Forms.Test.Views.SectionResultRows { @@ -64,18 +66,17 @@ // Assert Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); - - var expected2AValue = (RoundedDouble) (1 / result.AssessmentLayerTwoA); - var expected2AValueString = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expected2AValue + Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA ); - Assert.AreEqual( - expected2AValueString, - row.AssessmentLayerTwoA - ); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerTwoA)); + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] @@ -118,12 +119,10 @@ var row = new ClosingStructureSectionResultRow(result); // Call - row.AssessmentLayerTwoA = newValue.ToString(); + row.AssessmentLayerTwoA = newValue; // Assert - var expected = string.Format(CoreCommonBaseResources.ProbabilityPerYearFormat, newValue); - var actual = string.Format(CoreCommonBaseResources.ProbabilityPerYearFormat, result.AssessmentLayerTwoA); - Assert.AreEqual(expected, actual); + Assert.AreEqual(newValue, row.AssessmentLayerTwoA); } [Test] @@ -140,76 +139,15 @@ var row = new ClosingStructureSectionResultRow(result); // Call - TestDelegate test = () => row.AssessmentLayerTwoA = newValue.ToString(); + TestDelegate test = () => row.AssessmentLayerTwoA = newValue; // Assert var message = Assert.Throws(test).Message; - Assert.AreEqual( - Common.Data.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, - message - ); + Assert.AreEqual(RingtoetsCommonDataResources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, + message); } [Test] - [TestCase(double.MaxValue + 1)] - [TestCase(double.MinValue - 1)] - public void AssessmentLayerTwoA_ForTooLargeValues_ThrowsArgumentException(double value) - { - // Setup - var newValue = (RoundedDouble)value; - var section = CreateSection(); - var result = new ClosingStructureFailureMechanismSectionResult(section); - var row = new ClosingStructureSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = newValue.ToString(); - - // Assert - var message = Assert.Throws(test).Message; - Assert.AreEqual( - RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large, - message - ); - } - - [Test] - [TestCase("many")] - [TestCase("")] - public void AssessmentLayerTwoA_ForNonNumericValues_ThrowsArgumentException(string value) - { - // Setup - var section = CreateSection(); - var result = new ClosingStructureFailureMechanismSectionResult(section); - var row = new ClosingStructureSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = value; - - // Assert - var message = Assert.Throws(test).Message; - Assert.AreEqual( - RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value, - message - ); - } - - [Test] - public void AssessmentLayerTwoA_ForNullValue_ThrowsArgumentException() - { - // Setup - var section = CreateSection(); - var result = new ClosingStructureFailureMechanismSectionResult(section); - var row = new ClosingStructureSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = (string) null; - - // Assert - var expectedMessage = RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); - } - - [Test] public void AssessmentLayerThree_AlwaysOnChange_ResultPropertyChanged() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/DuneErosionSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/DuneErosionSectionResultRowTest.cs (.../DuneErosionSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/DuneErosionSectionResultRowTest.cs (.../DuneErosionSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -22,9 +22,12 @@ using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -58,6 +61,10 @@ Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverErosionOutwardsSectionResultRowTest.cs =================================================================== diff -u -rbd3056331b8727d6f9758d1f4e5979694d439398 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverErosionOutwardsSectionResultRowTest.cs (.../GrassCoverErosionOutwardsSectionResultRowTest.cs) (revision bd3056331b8727d6f9758d1f4e5979694d439398) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverErosionOutwardsSectionResultRowTest.cs (.../GrassCoverErosionOutwardsSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,12 +23,15 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -63,6 +66,10 @@ Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowTest.cs (.../GrassCoverSlipOffInwardsSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffInwardsSectionResultRowTest.cs (.../GrassCoverSlipOffInwardsSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,9 +23,12 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -60,6 +63,10 @@ Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs (.../GrassCoverSlipOffOutwardsSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/GrassCoverSlipOffOutwardsSectionResultRowTest.cs (.../GrassCoverSlipOffOutwardsSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,9 +23,12 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -60,6 +63,10 @@ Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacrostabilityInwardsSectionResultRowTest.cs =================================================================== diff -u -rbd3056331b8727d6f9758d1f4e5979694d439398 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacrostabilityInwardsSectionResultRowTest.cs (.../MacrostabilityInwardsSectionResultRowTest.cs) (revision bd3056331b8727d6f9758d1f4e5979694d439398) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacrostabilityInwardsSectionResultRowTest.cs (.../MacrostabilityInwardsSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,17 +23,19 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; -using Core.Common.TestUtil; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; -using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.Integration.Forms.Test.Views.SectionResultRows { @@ -64,18 +66,15 @@ // Assert Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); - - var expected2AValue = (RoundedDouble) (1 / result.AssessmentLayerTwoA); - var expected2AValueString = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expected2AValue - ); - Assert.AreEqual( - expected2AValueString, - row.AssessmentLayerTwoA - ); - + Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerTwoA)); + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] @@ -118,12 +117,10 @@ var row = new MacrostabilityInwardsSectionResultRow(result); // Call - row.AssessmentLayerTwoA = newValue.ToString(); + row.AssessmentLayerTwoA = newValue; // Assert - var expected = string.Format(CoreCommonBaseResources.ProbabilityPerYearFormat, newValue); - var actual = string.Format(CoreCommonBaseResources.ProbabilityPerYearFormat, result.AssessmentLayerTwoA); - Assert.AreEqual(expected, actual); + Assert.AreEqual(newValue, row.AssessmentLayerTwoA); } [Test] @@ -140,76 +137,15 @@ var row = new MacrostabilityInwardsSectionResultRow(result); // Call - TestDelegate test = () => row.AssessmentLayerTwoA = newValue.ToString(); + TestDelegate test = () => row.AssessmentLayerTwoA = newValue; // Assert var message = Assert.Throws(test).Message; - Assert.AreEqual( - Common.Data.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, - message - ); + Assert.AreEqual(RingtoetsCommonDataResources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, + message); } [Test] - [TestCase(double.MaxValue + 1)] - [TestCase(double.MinValue - 1)] - public void AssessmentLayerTwoA_ForTooLargeValues_ThrowsArgumentException(double value) - { - // Setup - var newValue = (RoundedDouble)value; - var section = CreateSection(); - var result = new MacrostabilityInwardsFailureMechanismSectionResult(section); - var row = new MacrostabilityInwardsSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = newValue.ToString(); - - // Assert - var message = Assert.Throws(test).Message; - Assert.AreEqual( - RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large, - message - ); - } - - [Test] - [TestCase("many")] - [TestCase("")] - public void AssessmentLayerTwoA_ForNonNumericValues_ThrowsArgumentException(string value) - { - // Setup - var section = CreateSection(); - var result = new MacrostabilityInwardsFailureMechanismSectionResult(section); - var row = new MacrostabilityInwardsSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = value; - - // Assert - var message = Assert.Throws(test).Message; - Assert.AreEqual( - RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value, - message - ); - } - - [Test] - public void AssessmentLayerTwoA_ForNullValue_ThrowsArgumentException() - { - // Setup - var section = CreateSection(); - var result = new MacrostabilityInwardsFailureMechanismSectionResult(section); - var row = new MacrostabilityInwardsSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = (string) null; - - // Assert - var expectedMessage = RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); - } - - [Test] public void AssessmentLayerThree_AlwaysOnChange_ResultPropertyChanged() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacrostabilityOutwardsSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacrostabilityOutwardsSectionResultRowTest.cs (.../MacrostabilityOutwardsSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacrostabilityOutwardsSectionResultRowTest.cs (.../MacrostabilityOutwardsSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,14 +23,16 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; -using Core.Common.TestUtil; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; -using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.Integration.Forms.Test.Views.SectionResultRows { @@ -61,18 +63,15 @@ // Assert Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); - - var expected2AValue = (RoundedDouble) (1 / result.AssessmentLayerTwoA); - var expected2AValueString = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expected2AValue - ); - Assert.AreEqual( - expected2AValueString, - row.AssessmentLayerTwoA - ); - + Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerTwoA)); + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] @@ -114,12 +113,10 @@ var row = new MacrostabilityOutwardsSectionResultRow(result); // Call - row.AssessmentLayerTwoA = newValue.ToString(); + row.AssessmentLayerTwoA = newValue; // Assert - var expected = string.Format(CoreCommonBaseResources.ProbabilityPerYearFormat, newValue); - var actual = string.Format(CoreCommonBaseResources.ProbabilityPerYearFormat, result.AssessmentLayerTwoA); - Assert.AreEqual(expected, actual); + Assert.AreEqual(newValue, row.AssessmentLayerTwoA); } [Test] @@ -136,76 +133,15 @@ var row = new MacrostabilityOutwardsSectionResultRow(result); // Call - TestDelegate test = () => row.AssessmentLayerTwoA = newValue.ToString(); + TestDelegate test = () => row.AssessmentLayerTwoA = newValue; // Assert var message = Assert.Throws(test).Message; - Assert.AreEqual( - Common.Data.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, - message - ); + Assert.AreEqual(RingtoetsCommonDataResources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, + message); } [Test] - [TestCase(double.MaxValue + 1)] - [TestCase(double.MinValue - 1)] - public void AssessmentLayerTwoA_ForTooLargeValues_ThrowsArgumentException(double value) - { - // Setup - var newValue = (RoundedDouble)value; - var section = CreateSection(); - var result = new MacrostabilityOutwardsFailureMechanismSectionResult(section); - var row = new MacrostabilityOutwardsSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = newValue.ToString(); - - // Assert - var message = Assert.Throws(test).Message; - Assert.AreEqual( - RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large, - message - ); - } - - [Test] - [TestCase("many")] - [TestCase("")] - public void AssessmentLayerTwoA_ForNonNumericValues_ThrowsArgumentException(string value) - { - // Setup - var section = CreateSection(); - var result = new MacrostabilityOutwardsFailureMechanismSectionResult(section); - var row = new MacrostabilityOutwardsSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = value; - - // Assert - var message = Assert.Throws(test).Message; - Assert.AreEqual( - RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value, - message - ); - } - - [Test] - public void AssessmentLayerTwoA_ForNullValue_ThrowsArgumentException() - { - // Setup - var section = CreateSection(); - var result = new MacrostabilityOutwardsFailureMechanismSectionResult(section); - var row = new MacrostabilityOutwardsSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = (string) null; - - // Assert - var expectedMessage = RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); - } - - [Test] public void AssessmentLayerThree_AlwaysOnChange_ResultPropertyChanged() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MicrostabilitySectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MicrostabilitySectionResultRowTest.cs (.../MicrostabilitySectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MicrostabilitySectionResultRowTest.cs (.../MicrostabilitySectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,9 +23,12 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -60,6 +63,10 @@ Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/PipingStructureSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/PipingStructureSectionResultRowTest.cs (.../PipingStructureSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/PipingStructureSectionResultRowTest.cs (.../PipingStructureSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,9 +23,12 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -60,6 +63,10 @@ Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StabilityStoneCoverSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StabilityStoneCoverSectionResultRowTest.cs (.../StabilityStoneCoverSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StabilityStoneCoverSectionResultRowTest.cs (.../StabilityStoneCoverSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -22,9 +22,12 @@ using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -58,6 +61,10 @@ Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs (.../StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs (.../StrengthStabilityLengthwiseConstructionSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,9 +23,12 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -59,6 +62,10 @@ Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityPointConstructionSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityPointConstructionSectionResultRowTest.cs (.../StrengthStabilityPointConstructionSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/StrengthStabilityPointConstructionSectionResultRowTest.cs (.../StrengthStabilityPointConstructionSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -22,14 +22,16 @@ using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; -using Core.Common.TestUtil; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; -using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.Integration.Forms.Test.Views.SectionResultRows { @@ -59,18 +61,15 @@ // Assert Assert.AreEqual(section.Name, row.Name); - - var expected2AValue = (RoundedDouble) (1 / result.AssessmentLayerTwoA); - var expected2AValueString = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expected2AValue - ); - Assert.AreEqual( - expected2AValueString, - row.AssessmentLayerTwoA - ); - + Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerTwoA)); + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] @@ -87,12 +86,10 @@ var row = new StrengthStabilityPointConstructionSectionResultRow(result); // Call - row.AssessmentLayerTwoA = newValue.ToString(); + row.AssessmentLayerTwoA = newValue; // Assert - var expected = string.Format(CoreCommonBaseResources.ProbabilityPerYearFormat, newValue); - var actual = string.Format(CoreCommonBaseResources.ProbabilityPerYearFormat, result.AssessmentLayerTwoA); - Assert.AreEqual(expected, actual); + Assert.AreEqual(newValue, row.AssessmentLayerTwoA); } [Test] @@ -109,76 +106,15 @@ var row = new StrengthStabilityPointConstructionSectionResultRow(result); // Call - TestDelegate test = () => row.AssessmentLayerTwoA = newValue.ToString(); + TestDelegate test = () => row.AssessmentLayerTwoA = newValue; // Assert var message = Assert.Throws(test).Message; - Assert.AreEqual( - Common.Data.Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, - message - ); + Assert.AreEqual(RingtoetsCommonDataResources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, + message); } [Test] - [TestCase(double.MaxValue + 1)] - [TestCase(double.MinValue - 1)] - public void AssessmentLayerTwoA_ForTooLargeValues_ThrowsArgumentException(double value) - { - // Setup - var newValue = (RoundedDouble)value; - var section = CreateSection(); - var result = new StrengthStabilityPointConstructionFailureMechanismSectionResult(section); - var row = new StrengthStabilityPointConstructionSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = newValue.ToString(); - - // Assert - var message = Assert.Throws(test).Message; - Assert.AreEqual( - RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_too_large, - message - ); - } - - [Test] - [TestCase("many")] - [TestCase("")] - public void AssessmentLayerTwoA_ForNonNumericValues_ThrowsArgumentException(string value) - { - // Setup - var section = CreateSection(); - var result = new StrengthStabilityPointConstructionFailureMechanismSectionResult(section); - var row = new StrengthStabilityPointConstructionSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = value; - - // Assert - var message = Assert.Throws(test).Message; - Assert.AreEqual( - RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Could_not_parse_string_to_double_value, - message - ); - } - - [Test] - public void AssessmentLayerTwoA_ForNullValue_ThrowsArgumentException() - { - // Setup - var section = CreateSection(); - var result = new StrengthStabilityPointConstructionFailureMechanismSectionResult(section); - var row = new StrengthStabilityPointConstructionSectionResultRow(result); - - // Call - TestDelegate test = () => row.AssessmentLayerTwoA = (string) null; - - // Assert - var expectedMessage = RingtoetsCommonFormsResources.ArbitraryProbabilityFailureMechanismSectionResultRow_AssessmentLayerTwoA_Value_cannot_be_null; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); - } - - [Test] public void AssessmentLayerThree_AlwaysOnChange_ResultPropertyChanged() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/TechnicalInnovationSectionResultRowTest.cs =================================================================== diff -u -rbd3056331b8727d6f9758d1f4e5979694d439398 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/TechnicalInnovationSectionResultRowTest.cs (.../TechnicalInnovationSectionResultRowTest.cs) (revision bd3056331b8727d6f9758d1f4e5979694d439398) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/TechnicalInnovationSectionResultRowTest.cs (.../TechnicalInnovationSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,12 +23,15 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -62,6 +65,10 @@ Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowTest.cs (.../WaterPressureAsphaltCoverSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/WaterPressureAsphaltCoverSectionResultRowTest.cs (.../WaterPressureAsphaltCoverSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,9 +23,12 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -59,6 +62,10 @@ Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/WaveImpactAsphaltCoverSectionResultRowTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/WaveImpactAsphaltCoverSectionResultRowTest.cs (.../WaveImpactAsphaltCoverSectionResultRowTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/WaveImpactAsphaltCoverSectionResultRowTest.cs (.../WaveImpactAsphaltCoverSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,9 +23,12 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultRows; @@ -60,6 +63,13 @@ Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerTwoA)); + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/ClosingStructureResultViewTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/ClosingStructureResultViewTest.cs (.../ClosingStructureResultViewTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/ClosingStructureResultViewTest.cs (.../ClosingStructureResultViewTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -28,6 +28,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Properties; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultViews; @@ -125,13 +126,10 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(result1.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); - var expectedAssessmentLayer2AValue1 = (RoundedDouble) (1/result1.AssessmentLayerTwoA); - var expectedAssessmentLayer2AString1 = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expectedAssessmentLayer2AValue1 - ); + var expectedAssessmentLayer2AString1 = ProbabilityFormattingHelper.Format(result1.AssessmentLayerTwoA); + Assert.AreEqual(expectedAssessmentLayer2AString1, cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", result1.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual(result1.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); @@ -140,13 +138,9 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(result2.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); - var expectedAssessmentLayer2AValue2 = (RoundedDouble)(1 / result2.AssessmentLayerTwoA); - var expectedAssessmentLayer2AString2 = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expectedAssessmentLayer2AValue2 - ); + var expectedAssessmentLayer2AString2 = ProbabilityFormattingHelper.Format(result2.AssessmentLayerTwoA); Assert.AreEqual(expectedAssessmentLayer2AString2, cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", result2.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual(result2.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); AssertCellIsEnabled(cells[assessmentLayerTwoAIndex]); AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityInwardsResultViewTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityInwardsResultViewTest.cs (.../MacrostabilityInwardsResultViewTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityInwardsResultViewTest.cs (.../MacrostabilityInwardsResultViewTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -28,6 +28,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Properties; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultViews; @@ -125,13 +126,9 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(result1.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); - var expectedAssessmentLayer2AValue1 = (RoundedDouble) (1/result1.AssessmentLayerTwoA); - var expectedAssessmentLayer2AString1 = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expectedAssessmentLayer2AValue1 - ); + var expectedAssessmentLayer2AString1 = ProbabilityFormattingHelper.Format(result1.AssessmentLayerTwoA); Assert.AreEqual(expectedAssessmentLayer2AString1, cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", result1.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual(result1.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); @@ -140,13 +137,9 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(result2.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); - var expectedAssessmentLayer2AValue2 = (RoundedDouble)(1 / result2.AssessmentLayerTwoA); - var expectedAssessmentLayer2AString2 = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expectedAssessmentLayer2AValue2 - ); + var expectedAssessmentLayer2AString2 = ProbabilityFormattingHelper.Format(result2.AssessmentLayerTwoA); Assert.AreEqual(expectedAssessmentLayer2AString2, cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", result2.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual(result2.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); AssertCellIsEnabled(cells[assessmentLayerTwoAIndex]); AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -28,6 +28,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Properties; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultViews; @@ -125,13 +126,9 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(result1.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); - var expectedAssessmentLayer2AValue1 = (RoundedDouble) (1/result1.AssessmentLayerTwoA); - var expectedAssessmentLayer2AString1 = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expectedAssessmentLayer2AValue1 - ); + var expectedAssessmentLayer2AString1 = ProbabilityFormattingHelper.Format(result1.AssessmentLayerTwoA); Assert.AreEqual(expectedAssessmentLayer2AString1, cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", result1.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual(result1.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); @@ -140,13 +137,9 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(result2.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); - var expectedAssessmentLayer2AValue2 = (RoundedDouble)(1 / result2.AssessmentLayerTwoA); - var expectedAssessmentLayer2AString2 = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expectedAssessmentLayer2AValue2 - ); + var expectedAssessmentLayer2AString2 = ProbabilityFormattingHelper.Format(result2.AssessmentLayerTwoA); Assert.AreEqual(expectedAssessmentLayer2AString2, cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", result2.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual(result2.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); AssertCellIsEnabled(cells[assessmentLayerTwoAIndex]); AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityPointConstructionResultViewTest.cs =================================================================== diff -u -rf72f906a6875250a4378945ce814997ff8aaf1a7 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityPointConstructionResultViewTest.cs (.../StrengthStabilityPointConstructionResultViewTest.cs) (revision f72f906a6875250a4378945ce814997ff8aaf1a7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityPointConstructionResultViewTest.cs (.../StrengthStabilityPointConstructionResultViewTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -27,6 +27,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Properties; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.Views.SectionResultViews; @@ -111,24 +112,16 @@ var cells = rows[0].Cells; Assert.AreEqual(3, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - var expectedAssessmentLayer2AValue1 = (RoundedDouble)(1 / result1.AssessmentLayerTwoA); - var expectedAssessmentLayer2AString1 = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expectedAssessmentLayer2AValue1 - ); + var expectedAssessmentLayer2AString1 = ProbabilityFormattingHelper.Format(result1.AssessmentLayerTwoA); Assert.AreEqual(expectedAssessmentLayer2AString1, cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", result1.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual(result1.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); cells = rows[1].Cells; Assert.AreEqual(3, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); - var expectedAssessmentLayer2AValue2 = (RoundedDouble)(1 / result2.AssessmentLayerTwoA); - var expectedAssessmentLayer2AString2 = string.Format( - CoreCommonBaseResources.ProbabilityPerYearFormat, - expectedAssessmentLayer2AValue2 - ); + var expectedAssessmentLayer2AString2 = ProbabilityFormattingHelper.Format(result2.AssessmentLayerTwoA); Assert.AreEqual(expectedAssessmentLayer2AString2, cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", result2.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual(result2.AssessmentLayerThree.ToString(), cells[assessmentLayerThreeIndex].FormattedValue); } } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculationScenario.cs =================================================================== diff -u -r14de3deecd2cff7f6abe41ed6dc5dc016c4c81e0 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculationScenario.cs (.../PipingCalculationScenario.cs) (revision 14de3deecd2cff7f6abe41ed6dc5dc016c4c81e0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingCalculationScenario.cs (.../PipingCalculationScenario.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -50,7 +50,7 @@ public RoundedDouble Contribution { get; set; } - public RoundedDouble Probability + public double Probability { get { Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSection2aAssessmentResultExtensions.cs =================================================================== diff -u -ra8e1897a44aceb5ed4c884797fbb80c9cb92d218 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSection2aAssessmentResultExtensions.cs (.../PipingFailureMechanismSection2aAssessmentResultExtensions.cs) (revision a8e1897a44aceb5ed4c884797fbb80c9cb92d218) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSection2aAssessmentResultExtensions.cs (.../PipingFailureMechanismSection2aAssessmentResultExtensions.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -35,16 +35,16 @@ /// /// The result to get the result for. /// All calculations in the failure mechanism. - public static RoundedDouble GetAssessmentLayerTwoA(this PipingFailureMechanismSectionResult pipingFailureMechanismSectionResult, IEnumerable calculations) + public static double GetAssessmentLayerTwoA(this PipingFailureMechanismSectionResult pipingFailureMechanismSectionResult, IEnumerable calculations) { var calculationScenarios = pipingFailureMechanismSectionResult .GetCalculationScenarios(calculations) .Where(cs => cs.Status == CalculationScenarioStatus.Done) .ToList(); return calculationScenarios.Any() - ? (RoundedDouble) (1.0/calculationScenarios.Sum(scenario => (scenario.Probability.Value)*scenario.Contribution.Value)) - : (RoundedDouble) 0.0; + ? calculationScenarios.Sum(scenario => scenario.Probability*scenario.Contribution.Value) + : double.NaN; } /// Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSectionResult.cs =================================================================== diff -u -ra8e1897a44aceb5ed4c884797fbb80c9cb92d218 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSectionResult.cs (.../PipingFailureMechanismSectionResult.cs) (revision a8e1897a44aceb5ed4c884797fbb80c9cb92d218) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSectionResult.cs (.../PipingFailureMechanismSectionResult.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -38,7 +38,9 @@ /// The to get the result from. /// Thrown when is null. public PipingFailureMechanismSectionResult(FailureMechanismSection section) : base(section) - {} + { + AssessmentLayerThree = (RoundedDouble)double.NaN; + } /// /// Gets or sets the value of assessment layer three. Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSemiProbabilisticOutput.cs =================================================================== diff -u -rd428a41a5451bcf43ee2ee5d489b122e0d0f4675 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSemiProbabilisticOutput.cs (.../PipingSemiProbabilisticOutput.cs) (revision d428a41a5451bcf43ee2ee5d489b122e0d0f4675) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSemiProbabilisticOutput.cs (.../PipingSemiProbabilisticOutput.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -1,6 +1,10 @@ -using Core.Common.Base.Data; +using System; + +using Core.Common.Base.Data; using Core.Common.Base.Storage; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; + namespace Ringtoets.Piping.Data { /// @@ -9,6 +13,12 @@ /// public class PipingSemiProbabilisticOutput : IStorable { + private double requiredProbability; + private double pipingProbability; + private double upliftProbability; + private double heaveProbability; + private double sellmeijerProbability; + /// /// Creates a new instance of . /// @@ -26,6 +36,8 @@ /// The calculated probability of failing due to piping. /// The calculated reliability of the piping failure mechanism. /// The factor of safety for the piping failure mechanism. + /// When setting a probability that falls + /// outside the [0.0, 1.0] range or isn't . public PipingSemiProbabilisticOutput(double upliftFactorOfSafety, double upliftReliability, double upliftProbability, double heaveFactorOfSafety, double heaveReliability, double heaveProbability, double sellmeijerFactorOfSafety, double sellmeijerReliability, double sellmeijerProbability, @@ -34,17 +46,17 @@ { UpliftFactorOfSafety = new RoundedDouble(3, upliftFactorOfSafety); UpliftReliability = new RoundedDouble(3, upliftReliability); - UpliftProbability = (RoundedDouble) upliftProbability; + UpliftProbability = upliftProbability; HeaveFactorOfSafety = new RoundedDouble(3, heaveFactorOfSafety); HeaveReliability = new RoundedDouble(3, heaveReliability); - HeaveProbability = (RoundedDouble) heaveProbability; + HeaveProbability = heaveProbability; SellmeijerFactorOfSafety = new RoundedDouble(3, sellmeijerFactorOfSafety); SellmeijerReliability = new RoundedDouble(3, sellmeijerReliability); - SellmeijerProbability = (RoundedDouble) sellmeijerProbability; + SellmeijerProbability = sellmeijerProbability; - RequiredProbability = (RoundedDouble) requiredProbability; + RequiredProbability = requiredProbability; RequiredReliability = new RoundedDouble(3, requiredReliability); - PipingProbability = (RoundedDouble) pipingProbability; + PipingProbability = pipingProbability; PipingReliability = new RoundedDouble(3, pipingReliability); PipingFactorOfSafety = new RoundedDouble(3, pipingFactorOfSafety); } @@ -53,7 +65,27 @@ /// Gets the required probability of the piping failure mechanism, /// which value in range [0,1]. /// - public RoundedDouble RequiredProbability { get; private set; } + /// When setting a value that falls + /// outside the [0.0, 1.0] range or isn't . + public double RequiredProbability + { + get + { + return requiredProbability; + } + private set + { + if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) + { + requiredProbability = value; + } + else + { + throw new ArgumentOutOfRangeException("value", + RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); + } + } + } /// /// Get the required reliability of the piping failure mechanism, @@ -77,7 +109,27 @@ /// Gets the probability of failing due to the piping failure mechanism, /// which value in range [0,1]. /// - public RoundedDouble PipingProbability { get; private set; } + /// When setting a value that falls + /// outside the [0.0, 1.0] range or isn't . + public double PipingProbability + { + get + { + return pipingProbability; + } + private set + { + if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) + { + pipingProbability = value; + } + else + { + throw new ArgumentOutOfRangeException("value", + RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); + } + } + } /// /// Gets the factor of safety for the uplift sub-mechanism, @@ -95,7 +147,27 @@ /// Gets the probability of failing due to the uplift failure sub-mechanism, /// which value in range [0,1]. /// - public RoundedDouble UpliftProbability { get; private set; } + /// When setting a value that falls + /// outside the [0.0, 1.0] range or isn't . + public double UpliftProbability + { + get + { + return upliftProbability; + } + private set + { + if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) + { + upliftProbability = value; + } + else + { + throw new ArgumentOutOfRangeException("value", + RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); + } + } + } /// /// Gets the factor of safety for the heave sub-mechanism, @@ -113,7 +185,27 @@ /// Gets the probability of failing due to the heave failure sub-mechanism, /// which value in range [0,1]. /// - public RoundedDouble HeaveProbability { get; private set; } + /// When setting a value that falls + /// outside the [0.0, 1.0] range or isn't . + public double HeaveProbability + { + get + { + return heaveProbability; + } + private set + { + if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) + { + heaveProbability = value; + } + else + { + throw new ArgumentOutOfRangeException("value", + RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); + } + } + } /// /// Gets the factor of safety for the Sellmeijer sub-mechanism, @@ -131,7 +223,27 @@ /// Gets the probability of failing due to the Sellmeijer failure sub-mechanism, /// which value in range [0,1]. /// - public RoundedDouble SellmeijerProbability { get; private set; } + /// When setting a value that falls + /// outside the [0.0, 1.0] range or isn't . + public double SellmeijerProbability + { + get + { + return sellmeijerProbability; + } + private set + { + if (double.IsNaN(value) || (0.0 <= value && value <= 1.0)) + { + sellmeijerProbability = value; + } + else + { + throw new ArgumentOutOfRangeException("value", + RingtoetsCommonDataResources.Probability_Must_be_in_range_zero_to_one); + } + } + } public long StorageId { get; set; } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj =================================================================== diff -u -r80c86231452b9beb7e8b8eba3698ceb9c0551de3 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 80c86231452b9beb7e8b8eba3698ceb9c0551de3) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -39,9 +39,6 @@ MinimumRecommendedRules.ruleset - - ..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll - Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingSemiProbabilisticOutputProperties.cs =================================================================== diff -u -re1705d17c577ac884869c00181cac52470cc50f2 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingSemiProbabilisticOutputProperties.cs (.../PipingSemiProbabilisticOutputProperties.cs) (revision e1705d17c577ac884869c00181cac52470cc50f2) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingSemiProbabilisticOutputProperties.cs (.../PipingSemiProbabilisticOutputProperties.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -2,6 +2,8 @@ using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; + +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.Properties; using CoreCommonResources = Core.Common.Base.Properties.Resources; @@ -42,7 +44,7 @@ { get { - return ToProbabilityFormat(data.UpliftProbability); + return ProbabilityFormattingHelper.Format(data.UpliftProbability); } } @@ -78,7 +80,7 @@ { get { - return ToProbabilityFormat(data.HeaveProbability); + return ProbabilityFormattingHelper.Format(data.HeaveProbability); } } @@ -114,7 +116,7 @@ { get { - return ToProbabilityFormat(data.SellmeijerProbability); + return ProbabilityFormattingHelper.Format(data.SellmeijerProbability); } } @@ -126,7 +128,7 @@ { get { - return ToProbabilityFormat(data.RequiredProbability); + return ProbabilityFormattingHelper.Format(data.RequiredProbability); } } @@ -150,7 +152,7 @@ { get { - return ToProbabilityFormat(data.PipingProbability); + return ProbabilityFormattingHelper.Format(data.PipingProbability); } } @@ -177,10 +179,5 @@ return data.PipingFactorOfSafety; } } - - private static string ToProbabilityFormat(RoundedDouble probability) - { - return string.Format(CoreCommonResources.ProbabilityPerYearFormat, (RoundedDouble) (1.0 / probability)); - } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj =================================================================== diff -u -r725bf2a9045d013dde7ff78d088bd433790ded88 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 725bf2a9045d013dde7ff78d088bd433790ded88) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -41,6 +41,7 @@ ..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll + True @@ -241,9 +242,9 @@ Copying.licenseheader - + Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismSectionResultRow.cs =================================================================== diff -u -r80c86231452b9beb7e8b8eba3698ceb9c0551de3 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismSectionResultRow.cs (.../PipingFailureMechanismSectionResultRow.cs) (revision 80c86231452b9beb7e8b8eba3698ceb9c0551de3) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismSectionResultRow.cs (.../PipingFailureMechanismSectionResultRow.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Core.Common.Base.Data; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Forms.Properties; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Piping.Data; using CommonBaseResources = Core.Common.Base.Properties.Resources; @@ -67,7 +68,8 @@ /// /// Gets the value representing the result of the layer 2a assessment. /// - public string AssessmentLayerTwoA + [TypeConverter(typeof(FailureMechanismSectionResultNoProbabilityValueRoundedDoubleConverter))] + public RoundedDouble AssessmentLayerTwoA { get { @@ -76,23 +78,22 @@ if (relevantScenarioAvailable && Math.Abs(SectionResult.GetTotalContribution(calculations) - 1.0) > tolerance) { - return string.Format("{0}", double.NaN); + return (RoundedDouble)double.NaN; } if (!relevantScenarioAvailable || SectionResult.GetCalculationScenarioStatus(calculations) != CalculationScenarioStatus.Done) { - return Resources.FailureMechanismSectionResultRow_AssessmentLayerTwoA_No_result_dash; + return (RoundedDouble)double.NaN; } - var layerTwoA = SectionResult.GetAssessmentLayerTwoA(calculations).Value; - - return string.Format(CommonBaseResources.ProbabilityPerYearFormat, layerTwoA); + return (RoundedDouble)SectionResult.GetAssessmentLayerTwoA(calculations); } } /// /// Gets or sets the value representing the result of the layer 3 assessment. /// + [TypeConverter(typeof(FailureMechanismSectionResultNoValueRoundedDoubleConverter))] public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingCalculationScenarioTest.cs =================================================================== diff -u -rbb0aeecc47206f5089ab04ca6c3575a1de8c206f -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingCalculationScenarioTest.cs (.../PipingCalculationScenarioTest.cs) (revision bb0aeecc47206f5089ab04ca6c3575a1de8c206f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingCalculationScenarioTest.cs (.../PipingCalculationScenarioTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -85,7 +85,7 @@ public void Probability_PipingOutputSet_ReturnsPipingOutputProbability() { // Setup - RoundedDouble expectedProbability = new RoundedDouble(0, 49862180); + var expectedProbability = 1.0 / 49862180; var scenario = new PipingCalculationScenario(new GeneralPipingInput()) { @@ -94,7 +94,7 @@ }; // Call - RoundedDouble probability = scenario.Probability; + double probability = scenario.Probability; // Assert Assert.AreEqual(expectedProbability, probability); @@ -107,7 +107,7 @@ var scenario = new PipingCalculationScenario(new GeneralPipingInput()); // Call - RoundedDouble probability; + double probability; TestDelegate call = () => probability = scenario.Probability; // Assert @@ -148,7 +148,7 @@ public void CalculationScenarioStatus_PipingOutputSet_ReturnsStatusDone() { // Setup - RoundedDouble expectedProbability = new RoundedDouble(0, 49862180); + var expectedProbability = 1.0/49862180; var scenario = new PipingCalculationScenario(new GeneralPipingInput()) { Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSection2aAssessmentResultExtensionsTest.cs =================================================================== diff -u -ra8e1897a44aceb5ed4c884797fbb80c9cb92d218 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSection2aAssessmentResultExtensionsTest.cs (.../PipingFailureMechanismSection2aAssessmentResultExtensionsTest.cs) (revision a8e1897a44aceb5ed4c884797fbb80c9cb92d218) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSection2aAssessmentResultExtensionsTest.cs (.../PipingFailureMechanismSection2aAssessmentResultExtensionsTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -41,8 +41,8 @@ var contribution1 = 0.2; var contribution2 = 0.8; - var probability1 = 1.0 / 1000000; - var probability2 = 1.0 / 2000000; + var probability1 = 1.0 / 1000000.0; + var probability2 = 1.0 / 2000000.0; var pipingCalculationScenario1 = PipingCalculationScenarioFactory.CreatePipingCalculationScenario(probability1, section); var pipingCalculationScenario2 = PipingCalculationScenarioFactory.CreatePipingCalculationScenario(probability2, section); @@ -65,10 +65,11 @@ }; // Call - RoundedDouble? assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(calculations); + double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(calculations); // Assert - Assert.AreEqual(1.0 / ((probability1) * contribution1 + (probability2) * contribution2), assessmentLayerTwoA, 1e-8); + double expectedProbability = probability1 * contribution1 + probability2 * contribution2; + Assert.AreEqual(expectedProbability, assessmentLayerTwoA, 1e-8); } [Test] @@ -82,10 +83,10 @@ pipingCalculationScenario.Contribution = (RoundedDouble)1.0; // Call - RoundedDouble assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new[] { pipingCalculationScenario }); + double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new[] { pipingCalculationScenario }); // Assert - Assert.AreEqual((RoundedDouble)0, assessmentLayerTwoA); + Assert.IsNaN(assessmentLayerTwoA); } [Test] @@ -96,10 +97,10 @@ var failureMechanismSectionResult = new PipingFailureMechanismSectionResult(section); // Call - RoundedDouble? assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(Enumerable.Empty()); + double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(Enumerable.Empty()); // Assert - Assert.AreEqual((RoundedDouble)0.0, assessmentLayerTwoA); + Assert.IsNaN(assessmentLayerTwoA); } [Test] @@ -115,10 +116,10 @@ var calculationScenarios = new[] { calculationScenarioMock, calculationScenarioMock2 }; // Call - RoundedDouble assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(calculationScenarios); + double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(calculationScenarios); // Assert - Assert.AreEqual((RoundedDouble)0.0, assessmentLayerTwoA); + Assert.IsNaN(assessmentLayerTwoA); } [Test] @@ -131,10 +132,10 @@ var pipingCalculationScenario = PipingCalculationScenarioFactory.CreateNotCalculatedPipingCalculationScenario(section); // Call - RoundedDouble assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new[] { pipingCalculationScenario }); + double assessmentLayerTwoA = failureMechanismSectionResult.GetAssessmentLayerTwoA(new[] { pipingCalculationScenario }); // Assert - Assert.AreEqual((RoundedDouble)0, assessmentLayerTwoA); + Assert.IsNaN(assessmentLayerTwoA); } [Test] @@ -223,7 +224,7 @@ FailureMechanismSection section = CreateSection(); var failureMechanismSectionResult = new PipingFailureMechanismSectionResult(section); - var expectedProbability = 41661830; + var expectedProbability = 0.1; var pipingCalculationScenario = PipingCalculationScenarioFactory.CreatePipingCalculationScenario(expectedProbability, section); pipingCalculationScenario.Contribution = (RoundedDouble)1.0; Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSectionResultTest.cs =================================================================== diff -u -r1cd3618f5f8916ef15992d69ec3b447b311c2f72 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSectionResultTest.cs (.../PipingFailureMechanismSectionResultTest.cs) (revision 1cd3618f5f8916ef15992d69ec3b447b311c2f72) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSectionResultTest.cs (.../PipingFailureMechanismSectionResultTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -23,6 +23,8 @@ using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Base.Storage; +using Core.Common.TestUtil; + using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; @@ -45,8 +47,8 @@ Assert.IsInstanceOf(sectionResult); Assert.AreSame(section, sectionResult.Section); Assert.IsFalse(sectionResult.AssessmentLayerOne); - Assert.AreEqual((RoundedDouble) 0, sectionResult.GetAssessmentLayerTwoA(new PipingCalculationScenario[0])); - Assert.AreEqual((RoundedDouble)0, sectionResult.AssessmentLayerThree); + Assert.IsNaN(sectionResult.GetAssessmentLayerTwoA(new PipingCalculationScenario[0])); + Assert.IsNaN(sectionResult.AssessmentLayerThree); Assert.AreEqual(0, sectionResult.StorageId); } Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSemiProbabilisticOutputTest.cs =================================================================== diff -u -r8293556a04e3650c9978df7a50f8f8ad0d792ed8 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSemiProbabilisticOutputTest.cs (.../PipingSemiProbabilisticOutputTest.cs) (revision 8293556a04e3650c9978df7a50f8f8ad0d792ed8) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSemiProbabilisticOutputTest.cs (.../PipingSemiProbabilisticOutputTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -22,6 +22,7 @@ using System; using Core.Common.Base.Storage; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.TestUtil; @@ -73,20 +74,475 @@ Assert.AreEqual(upliftFactorOfSafety, output.UpliftFactorOfSafety, output.UpliftFactorOfSafety.GetAccuracy()); Assert.AreEqual(upliftReliability, output.UpliftReliability, output.UpliftReliability.GetAccuracy()); - Assert.AreEqual(upliftProbability, output.UpliftProbability, output.UpliftProbability.GetAccuracy()); + Assert.AreEqual(upliftProbability, output.UpliftProbability); Assert.AreEqual(heaveFactorOfSafety, output.HeaveFactorOfSafety, output.HeaveFactorOfSafety.GetAccuracy()); Assert.AreEqual(heaveReliability, output.HeaveReliability, output.HeaveReliability.GetAccuracy()); - Assert.AreEqual(heaveProbability, output.HeaveProbability, output.HeaveProbability.GetAccuracy()); + Assert.AreEqual(heaveProbability, output.HeaveProbability); Assert.AreEqual(sellmeijerFactorOfSafety, output.SellmeijerFactorOfSafety, output.SellmeijerFactorOfSafety.GetAccuracy()); Assert.AreEqual(sellmeijerReliability, output.SellmeijerReliability, output.SellmeijerReliability.GetAccuracy()); - Assert.AreEqual(sellmeijerProbability, output.SellmeijerProbability, output.SellmeijerProbability.GetAccuracy()); - Assert.AreEqual(requiredProbability, output.RequiredProbability, output.RequiredProbability.GetAccuracy()); + Assert.AreEqual(sellmeijerProbability, output.SellmeijerProbability); + Assert.AreEqual(requiredProbability, output.RequiredProbability); Assert.AreEqual(requiredReliability, output.RequiredReliability, output.RequiredReliability.GetAccuracy()); - Assert.AreEqual(pipingProbability, output.PipingProbability, output.PipingProbability.GetAccuracy()); + Assert.AreEqual(pipingProbability, output.PipingProbability); Assert.AreEqual(pipingReliability, output.PipingReliability, output.PipingReliability.GetAccuracy()); Assert.AreEqual(pipingFactorOfSafety, output.PipingFactorOfSafety, output.PipingFactorOfSafety.GetAccuracy()); Assert.AreEqual(0, output.StorageId); } + + [Test] + [TestCase(double.NaN)] + [TestCase(0.0)] + [TestCase(0.123456789)] + [TestCase(1.0)] + public void RequiredProbability_SetValidValues_ReturnNewlySetValue(double requiredProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double upliftProbability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double heaveProbability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double sellmeijerProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingProbability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + var output = new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + Assert.AreEqual(requiredProbability, output.RequiredProbability); + } + + [Test] + [TestCase(double.PositiveInfinity)] + [TestCase(double.NegativeInfinity)] + [TestCase(0.0-1e-6)] + [TestCase(-346587.456)] + [TestCase(1.0+1e-6)] + [TestCase(346587.456)] + public void RequiredProbability_SetInvalidValues_ThrowArgumentOutOfRangeException(double requiredProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double upliftProbability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double heaveProbability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double sellmeijerProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingProbability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + TestDelegate call = () => new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + string expectedMessage = "Kans moet in het bereik [0, 1] opgegeven worden."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + } + + [Test] + [TestCase(double.NaN)] + [TestCase(0.0)] + [TestCase(0.123456789)] + [TestCase(1.0)] + public void SellmeijerProbability_SetValidValues_ReturnNewlySetValue(double sellmeijerProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double upliftProbability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double heaveProbability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double requiredProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingProbability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + var output = new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + Assert.AreEqual(sellmeijerProbability, output.SellmeijerProbability); + } + + [Test] + [TestCase(double.PositiveInfinity)] + [TestCase(double.NegativeInfinity)] + [TestCase(0.0 - 1e-6)] + [TestCase(-346587.456)] + [TestCase(1.0 + 1e-6)] + [TestCase(346587.456)] + public void SellmeijerProbability_SetInvalidValues_ThrowArgumentOutOfRangeException(double sellmeijerProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double upliftProbability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double heaveProbability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double requiredProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingProbability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + TestDelegate call = () => new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + string expectedMessage = "Kans moet in het bereik [0, 1] opgegeven worden."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + } + + [Test] + [TestCase(double.NaN)] + [TestCase(0.0)] + [TestCase(0.123456789)] + [TestCase(1.0)] + public void HeaveProbability_SetValidValues_ReturnNewlySetValue(double heaveProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double upliftProbability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double sellmeijerProbability = random.NextDouble(); + double requiredProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingProbability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + var output = new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + Assert.AreEqual(heaveProbability, output.HeaveProbability); + } + + [Test] + [TestCase(double.PositiveInfinity)] + [TestCase(double.NegativeInfinity)] + [TestCase(0.0 - 1e-2)] + [TestCase(-346587.456)] + [TestCase(1.0 + 1e-2)] + [TestCase(346587.456)] + public void HeaveProbability_SetInvalidValues_ThrowArgumentOutOfRangeException(double heaveProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double upliftProbability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double sellmeijerProbability = random.NextDouble(); + double requiredProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingProbability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + TestDelegate call = () => new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + string expectedMessage = "Kans moet in het bereik [0, 1] opgegeven worden."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + } + + [Test] + [TestCase(double.NaN)] + [TestCase(0.0)] + [TestCase(0.123456789)] + [TestCase(1.0)] + public void UpliftProbability_SetValidValues_ReturnNewlySetValue(double upliftProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double heaveProbability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double sellmeijerProbability = random.NextDouble(); + double requiredProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingProbability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + var output = new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + Assert.AreEqual(upliftProbability, output.UpliftProbability); + } + + [Test] + [TestCase(double.PositiveInfinity)] + [TestCase(double.NegativeInfinity)] + [TestCase(0.0 - 1e-6)] + [TestCase(-346587.456)] + [TestCase(1.0 + 1e-6)] + [TestCase(346587.456)] + public void UpliftProbability_SetInvalidValues_ThrowArgumentOutOfRangeException(double upliftProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double heaveProbability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double sellmeijerProbability = random.NextDouble(); + double requiredProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingProbability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + TestDelegate call = () => new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + string expectedMessage = "Kans moet in het bereik [0, 1] opgegeven worden."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + } + + [Test] + [TestCase(double.NaN)] + [TestCase(0.0)] + [TestCase(0.123456789)] + [TestCase(1.0)] + public void PipingProbability_SetValidValues_ReturnNewlySetValue(double pipingProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double upliftProbability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double heaveProbability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double sellmeijerProbability = random.NextDouble(); + double requiredProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + var output = new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + Assert.AreEqual(pipingProbability, output.PipingProbability); + } + + [Test] + [TestCase(double.PositiveInfinity)] + [TestCase(double.NegativeInfinity)] + [TestCase(0.0 - 1e-2)] + [TestCase(-346587.456)] + [TestCase(1.0 + 1e-2)] + [TestCase(346587.456)] + public void PipingProbability_SetInvalidValues_ThrowArgumentOutOfRangeException(double pipingProbability) + { + // Setup + var random = new Random(21); + double upliftFactorOfSafety = random.NextDouble(); + double upliftReliability = random.NextDouble(); + double upliftProbability = random.NextDouble(); + double heaveFactorOfSafety = random.NextDouble(); + double heaveReliability = random.NextDouble(); + double heaveProbability = random.NextDouble(); + double sellmeijerFactorOfSafety = random.NextDouble(); + double sellmeijerReliability = random.NextDouble(); + double sellmeijerProbability = random.NextDouble(); + double requiredProbability = random.NextDouble(); + double requiredReliability = random.NextDouble(); + double pipingReliability = random.NextDouble(); + double pipingFactorOfSafety = random.NextDouble(); + + // Call + TestDelegate call = () => new PipingSemiProbabilisticOutput( + upliftFactorOfSafety, + upliftReliability, + upliftProbability, + heaveFactorOfSafety, + heaveReliability, + heaveProbability, + sellmeijerFactorOfSafety, + sellmeijerReliability, + sellmeijerProbability, + requiredProbability, + requiredReliability, + pipingProbability, + pipingReliability, + pipingFactorOfSafety); + + // Assert + string expectedMessage = "Kans moet in het bereik [0, 1] opgegeven worden."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj =================================================================== diff -u -r49f905d3363336d44ef828259692644dcf5f9edc -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 49f905d3363336d44ef828259692644dcf5f9edc) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -96,10 +96,6 @@ {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2} Ringtoets.HydraRing.Data - - {7CD038E1-E111-4969-ACED-22C5BD2974E1} - Ringtoets.Piping.Forms - {D64E4F0E-E341-496F-82B2-941AD202B4E3} Ringtoets.Piping.KernelWrapper Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/PipingCalculationScenarioFactoryTest.cs =================================================================== diff -u -r80c86231452b9beb7e8b8eba3698ceb9c0551de3 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/PipingCalculationScenarioFactoryTest.cs (.../PipingCalculationScenarioFactoryTest.cs) (revision 80c86231452b9beb7e8b8eba3698ceb9c0551de3) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/PipingCalculationScenarioFactoryTest.cs (.../PipingCalculationScenarioFactoryTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -21,9 +21,9 @@ [Test] [TestCase(double.NaN)] - [TestCase(3.0)] - [TestCase(115.2)] - [TestCase(0.2)] + [TestCase(0.0)] + [TestCase(0.8)] + [TestCase(1.0)] public void CreatePipingCalculationScenario_WithSection_CreatesRelevantCalculationWithOutputSet(double probability) { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj =================================================================== diff -u -re0e813ab11c3b35020a785cebf275366cd2eaf9d -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision e0e813ab11c3b35020a785cebf275366cd2eaf9d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -125,6 +125,10 @@ {30e4c2ae-719e-4d70-9fa9-668a9767fbfa} Core.Common.Gui + + {f49bd8b2-332a-4c91-a196-8cce0a2c7d98} + Core.Common.Utils + {26214BD0-DAFB-4CFC-8EB2-80C5D53C859E} Core.Common.Gui.TestUtil Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs =================================================================== diff -u -r80c86231452b9beb7e8b8eba3698ceb9c0551de3 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs (.../PipingFailureMechanismResultViewTest.cs) (revision 80c86231452b9beb7e8b8eba3698ceb9c0551de3) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismResultViewTest.cs (.../PipingFailureMechanismResultViewTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -161,14 +161,14 @@ Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.IsFalse((bool) cells[assessmentLayerOneIndex].FormattedValue); Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); cells = rows[1].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); Assert.IsFalse((bool) cells[assessmentLayerOneIndex].FormattedValue); Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); } } @@ -195,7 +195,7 @@ Assert.AreEqual(checkBoxSelected, (bool) cells[assessmentLayerOneIndex].FormattedValue); Assert.AreEqual("-", cellAssessmentLayerTwoA.FormattedValue); - Assert.AreEqual(string.Format("{0}", 0), cellAssessmentLayerThree.FormattedValue); + Assert.AreEqual("-", cellAssessmentLayerThree.FormattedValue); var cellAssessmentLayerTwoABackColor = cellAssessmentLayerTwoA.Style.BackColor; var cellAssessmentLayerTwoAForeColor = cellAssessmentLayerTwoA.Style.ForeColor; @@ -303,7 +303,7 @@ using (var view = ShowFullyConfiguredFailureMechanismResultsView(pipingFailureMechanism)) { var calculationScenario = PipingCalculationScenarioFactory.CreatePipingCalculationScenario( - 1000, + 1.0/1000.0, pipingFailureMechanism.Sections.First() ); calculationScenario.Contribution = (RoundedDouble)0.3; @@ -320,7 +320,7 @@ // Assert Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridViewCell.ErrorText); - Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), formattedValue); + Assert.AreEqual("-", formattedValue); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -r8293556a04e3650c9978df7a50f8f8ad0d792ed8 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs (.../PipingFailureMechanismSectionResultRowTest.cs) (revision 8293556a04e3650c9978df7a50f8f8ad0d792ed8) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismSectionResultRowTest.cs (.../PipingFailureMechanismSectionResultRowTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -24,12 +24,14 @@ using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.Utils.Reflection; + using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; -using Ringtoets.Common.Forms.Properties; +using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.TestUtil; using Ringtoets.Piping.Forms.Views; @@ -66,6 +68,13 @@ Assert.AreEqual(section.Name, row.Name); Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree); + + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerTwoA)); + Assert.IsTrue(TypeUtils.HasTypeConverter( + r => r.AssessmentLayerThree)); } [Test] @@ -95,7 +104,7 @@ } [Test] - public void AssessmentLayerTwoA_NoScenarios_ShowDash() + public void AssessmentLayerTwoA_NoScenarios_ReturnNaN() { // Setup var section = CreateSection(); @@ -105,7 +114,7 @@ var row = new PipingFailureMechanismSectionResultRow(result, Enumerable.Empty()); // Assert - Assert.AreEqual(Resources.FailureMechanismSectionResultRow_AssessmentLayerTwoA_No_result_dash, row.AssessmentLayerTwoA); + Assert.IsNaN(row.AssessmentLayerTwoA); } [Test] @@ -114,7 +123,7 @@ [TestCase(0.3,0.7+1e-5)] [TestCase(-5,-8)] [TestCase(13,2)] - public void AssessmentLayerTwoA_RelevantScenarioContributionDontAddUpTo1_NaN(double contributionA, double contributionB) + public void AssessmentLayerTwoA_RelevantScenarioContributionDontAddUpTo1_ReturnNaN(double contributionA, double contributionB) { // Setup var section = CreateSection(); @@ -131,13 +140,13 @@ var assessmentLayerTwoA = row.AssessmentLayerTwoA; // Assert - Assert.AreEqual(string.Format("{0}", double.NaN), assessmentLayerTwoA); + Assert.IsNaN(assessmentLayerTwoA); } [Test] [TestCase(CalculationScenarioStatus.NotCalculated)] [TestCase(CalculationScenarioStatus.Failed)] - public void AssessmentLayerTwoA_NoRelevantScenariosDone_Dash(CalculationScenarioStatus status) + public void AssessmentLayerTwoA_NoRelevantScenariosDone_ReturnNaN(CalculationScenarioStatus status) { // Setup var section = CreateSection(); @@ -153,7 +162,7 @@ var assessmentLayerTwoA = row.AssessmentLayerTwoA; // Assert - Assert.AreEqual(Resources.FailureMechanismSectionResultRow_AssessmentLayerTwoA_No_result_dash, assessmentLayerTwoA); + Assert.IsNaN(assessmentLayerTwoA); } [Test] @@ -171,8 +180,8 @@ var assessmentLayerTwoA = row.AssessmentLayerTwoA; // Assert - var expected = string.Format(CommonBaseResources.ProbabilityPerYearFormat, result.GetAssessmentLayerTwoA(new[] { scenario })); - Assert.AreEqual(expected, assessmentLayerTwoA); + var expected = result.GetAssessmentLayerTwoA(new[] { scenario }); + Assert.AreEqual(expected, assessmentLayerTwoA, 1e-6); } [Test] Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingFailureMechanismResultViewIntegrationTest.cs =================================================================== diff -u -r516f10118109eb4056794904fa280b9df0c7ca1f -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingFailureMechanismResultViewIntegrationTest.cs (.../PipingFailureMechanismResultViewIntegrationTest.cs) (revision 516f10118109eb4056794904fa280b9df0c7ca1f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingFailureMechanismResultViewIntegrationTest.cs (.../PipingFailureMechanismResultViewIntegrationTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -96,7 +96,7 @@ // Add another, nested calculation and ensure the data grid view is updated nestedPipingCalculationGroup.Children.Add(pipingCalculation2); nestedPipingCalculationGroup.NotifyObservers(); - Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); // Set the second calculation to not relevant and ensure the data grid view is updated @@ -106,7 +106,7 @@ Assert.AreEqual("Niet alle berekeningen voor dit vak zijn uitgevoerd.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); // Execute the first calculation and ensure the data grid view is updated - const double probability = 31846382; + const double probability = 1.0/31846382.0; pipingCalculation1.Output = new PipingOutput(0, 0, 0, 0, 0, 0); pipingCalculation1.SemiProbabilisticOutput = new PipingSemiProbabilisticOutput(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, probability, 0, 0); pipingCalculation1.NotifyObservers(); @@ -122,13 +122,13 @@ pipingCalculation3.InputParameters.SurfaceLine = assessmentSection.PipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0001"); pipingCalculation3.InputParameters.NotifyObservers(); - Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); // Change the contribution of the calculation and make sure the data grid view is updated pipingCalculation3.Contribution = (RoundedDouble) 0.3; pipingCalculation3.NotifyObservers(); - Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); pipingCalculation1.Contribution = (RoundedDouble) 0.7; @@ -139,7 +139,7 @@ // Remove a calculation and make sure the data grid view is updated nestedPipingCalculationGroup.Children.Remove(pipingCalculation3); nestedPipingCalculationGroup.NotifyObservers(); - Assert.AreEqual(double.NaN.ToString(CultureInfo.InvariantCulture), dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].FormattedValue); Assert.AreEqual("Bijdrage van de geselecteerde scenario's voor dit vak is opgeteld niet gelijk aan 100%.", dataGridView.Rows[22].Cells[assessmentLayerTwoAIndex].ErrorText); // Set contribution again so we have a probability. Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/Ringtoets.Piping.Integration.Test.csproj =================================================================== diff -u -r49d90fb457184cd520ada77ee07774405985abd5 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/Ringtoets.Piping.Integration.Test.csproj (.../Ringtoets.Piping.Integration.Test.csproj) (revision 49d90fb457184cd520ada77ee07774405985abd5) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/Ringtoets.Piping.Integration.Test.csproj (.../Ringtoets.Piping.Integration.Test.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -109,10 +109,6 @@ {11F1F874-45AF-43E4-8AE5-15A5C9593E28} Ringtoets.Integration.Data - - {AD0CDC89-0A00-4068-AEEC-9838863C2FE8} - Ringtoets.Integration.Forms - {C8383B76-B3F1-4E6E-B56C-527B469FA20A} Ringtoets.Integration.Plugin @@ -138,10 +134,6 @@ {14C6F716-64E2-4BC4-A1EF-05865FCEFA4C} Ringtoets.Piping.Primitives - - {10B8D63D-87E8-46DF-ACA9-A8CF22EE8FB5} - Ringtoets.Piping.Service - Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingSemiProbabilisticCalculationServiceTest.cs =================================================================== diff -u -r845bead95b248fd299e02c02e9ae0892eebc6335 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingSemiProbabilisticCalculationServiceTest.cs (.../PipingSemiProbabilisticCalculationServiceTest.cs) (revision 845bead95b248fd299e02c02e9ae0892eebc6335) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingSemiProbabilisticCalculationServiceTest.cs (.../PipingSemiProbabilisticCalculationServiceTest.cs) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -45,10 +45,10 @@ PipingSemiProbabilisticCalculationService.Calculate(calculation, new PipingProbabilityAssessmentInput(), norm, double.NaN); // Call - RoundedDouble result = calculation.SemiProbabilisticOutput.UpliftProbability; + double result = calculation.SemiProbabilisticOutput.UpliftProbability; // Assert - Assert.AreEqual(expectedResult, result, result.GetAccuracy()); + Assert.AreEqual(expectedResult, result, 1e-6); } [Test] @@ -65,10 +65,10 @@ PipingSemiProbabilisticCalculationService.Calculate(calculation, new PipingProbabilityAssessmentInput(), norm, double.NaN); // Call - RoundedDouble result = calculation.SemiProbabilisticOutput.HeaveProbability; + double result = calculation.SemiProbabilisticOutput.HeaveProbability; // Assert - Assert.AreEqual(expectedResult, result, result.GetAccuracy()); + Assert.AreEqual(expectedResult, result, 1e-6); } [Test] @@ -85,10 +85,10 @@ PipingSemiProbabilisticCalculationService.Calculate(calculation, new PipingProbabilityAssessmentInput(), norm, double.NaN); // Call - RoundedDouble result = calculation.SemiProbabilisticOutput.SellmeijerProbability; + double result = calculation.SemiProbabilisticOutput.SellmeijerProbability; // Assert - Assert.AreEqual(expectedResult, result, result.GetAccuracy()); + Assert.AreEqual(expectedResult, result, 1e-6); } [Test] Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/Ringtoets.Piping.Service.Test.csproj =================================================================== diff -u -r1f622b4c6f58e22a752097c0375fe68f370a3fb2 -rce94b8228bc7e51779b3754217580f13cb35e475 --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/Ringtoets.Piping.Service.Test.csproj (.../Ringtoets.Piping.Service.Test.csproj) (revision 1f622b4c6f58e22a752097c0375fe68f370a3fb2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/Ringtoets.Piping.Service.Test.csproj (.../Ringtoets.Piping.Service.Test.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) @@ -85,14 +85,6 @@ {70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2} Ringtoets.HydraRing.Data - - {7CD038E1-E111-4969-ACED-22C5BD2974E1} - Ringtoets.Piping.Forms - - - {97F6406A-6338-4863-92A6-0D5C00A5F7C9} - Ringtoets.Piping.InputParameterCalculation - {D64E4F0E-E341-496F-82B2-941AD202B4E3} Ringtoets.Piping.KernelWrapper