Index: Core/Common/src/Core.Common.Base/Data/RoundedDouble.cs =================================================================== diff -u -r22f847897e3a8dcefbb04b51dd1fc346448cd62d -ra887863a3992744a394591e17072811eb9478ebc --- Core/Common/src/Core.Common.Base/Data/RoundedDouble.cs (.../RoundedDouble.cs) (revision 22f847897e3a8dcefbb04b51dd1fc346448cd62d) +++ Core/Common/src/Core.Common.Base/Data/RoundedDouble.cs (.../RoundedDouble.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -14,7 +14,8 @@ private double value; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class with a value + /// of 0. /// /// The number of decimal places. /// @@ -32,6 +33,29 @@ } /// + /// Initializes a new instance of the class with a + /// given value. + /// + /// The number of decimal places. + /// The value to initalize the instance with. + /// + /// Thrown when is not in range [0, 28]. + /// + /// When is too big + /// or too small to be represented as a rounded double. + public RoundedDouble(int numberOfDecimalPlaces, double value) + { + if (numberOfDecimalPlaces < 0 || numberOfDecimalPlaces > 28) + { + throw new ArgumentOutOfRangeException("numberOfDecimalPlaces", + "Value must be in range [0, 28]."); + } + + NumberOfDecimalPlaces = numberOfDecimalPlaces; + Value = value; + } + + /// /// Gets the number of decimal places use to round to. /// public int NumberOfDecimalPlaces { get; private set; } Index: Core/Common/test/Core.Common.Base.Test/Data/RoundedDoubleTest.cs =================================================================== diff -u -r22f847897e3a8dcefbb04b51dd1fc346448cd62d -ra887863a3992744a394591e17072811eb9478ebc --- Core/Common/test/Core.Common.Base.Test/Data/RoundedDoubleTest.cs (.../RoundedDoubleTest.cs) (revision 22f847897e3a8dcefbb04b51dd1fc346448cd62d) +++ Core/Common/test/Core.Common.Base.Test/Data/RoundedDoubleTest.cs (.../RoundedDoubleTest.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -27,6 +27,48 @@ } [Test] + [TestCase(1.0, 2, 1.00)] + [TestCase(123456789.0, 3, 123456789.000)] + [TestCase(12345678.90, 2, 12345678.90)] + [TestCase(12345678.90, 3, 12345678.900)] + [TestCase(1234567.890, 2, 1234567.89)] + [TestCase(1234567.890, 3, 1234567.890)] + [TestCase(123456.7890, 2, 123456.79)] + [TestCase(123456.7890, 3, 123456.789)] + [TestCase(12345.67890, 2, 12345.68)] + [TestCase(12345.67890, 3, 12345.679)] + [TestCase(1234.567890, 2, 1234.57)] + [TestCase(1234.567890, 3, 1234.568)] + [TestCase(123.4567890, 2, 123.46)] + [TestCase(123.4567890, 3, 123.457)] + [TestCase(12.34567890, 2, 12.35)] + [TestCase(12.34567890, 3, 12.346)] + [TestCase(1.234567890, 2, 1.23)] + [TestCase(1.234567890, 3, 1.235)] + [TestCase(0.1234567890, 2, 0.12)] + [TestCase(0.1234567890, 3, 0.123)] + [TestCase(0.01234567890, 2, 0.01)] + [TestCase(0.01234567890, 3, 0.012)] + [TestCase(0.001234567890, 2, 0.00)] + [TestCase(0.001234567890, 3, 0.001)] + [TestCase(0.0001234567890, 2, 0.00)] + [TestCase(0.0001234567890, 3, 0.000)] + [TestCase(double.NaN, 2, double.NaN)] + [TestCase(double.PositiveInfinity, 4, double.PositiveInfinity)] + [TestCase(double.NegativeInfinity, 3, double.NegativeInfinity)] + public void Constructor_ExpectedValues(double doubleValue, int numberOfDecimalPlaces, double expectedRoundedValue) + { + // Call + var roundedDouble = new RoundedDouble(numberOfDecimalPlaces, doubleValue); + + // Assert + Assert.IsInstanceOf>(roundedDouble); + Assert.IsInstanceOf>(roundedDouble); + Assert.AreEqual(numberOfDecimalPlaces, roundedDouble.NumberOfDecimalPlaces); + Assert.AreEqual(expectedRoundedValue, roundedDouble.Value); + } + + [Test] [TestCase(-45678)] [TestCase(-1)] [TestCase(29)] Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs =================================================================== diff -u -r0c2ba533bc2cf8f4693c468e07f73737e2cc6644 -ra887863a3992744a394591e17072811eb9478ebc --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision 0c2ba533bc2cf8f4693c468e07f73737e2cc6644) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -117,7 +117,7 @@ calculation.InputParameters.SetSurfaceLine(pipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0001")); calculation.InputParameters.SoilProfile = pipingFailureMechanism.SoilProfiles.First(sl => sl.Name == "AD640M00_Segment_36005_1D2"); calculation.InputParameters.PhreaticLevelExit.Mean = 3; - calculation.InputParameters.AssessmentLevel = 0.0; + calculation.InputParameters.AssessmentLevel.Value = 0.0; calculation.InputParameters.ThicknessCoverageLayer = new LognormalDistribution(); calculation.InputParameters.ThicknessAquiferLayer = new LognormalDistribution(); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs =================================================================== diff -u -r9d0bb6ba6d087fa3d615908f6d40252243ac635e -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 9d0bb6ba6d087fa3d615908f6d40252243ac635e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -22,6 +22,7 @@ using System; using Core.Common.Base; +using Core.Common.Base.Data; using Ringtoets.HydraRing.Data; using Ringtoets.Piping.Data.Probabilistics; @@ -37,7 +38,7 @@ { private const double seepageLengthStandardDeviationFraction = 0.1; private readonly GeneralPipingInput generalInputParameters; - private double assessmentLevel; + private RoundedDouble assessmentLevel; private double exitPointL; private double entryPointL; @@ -59,7 +60,7 @@ exitPointL = double.NaN; entryPointL = double.NaN; - assessmentLevel = double.NaN; + assessmentLevel = new RoundedDouble(2, double.NaN); PhreaticLevelExit = new NormalDistribution(); DampingFactorExit = new LognormalDistribution @@ -90,19 +91,15 @@ /// [m] /// /// is . - public double AssessmentLevel + public RoundedDouble AssessmentLevel { get { return assessmentLevel; } set { - if (double.IsNaN(value)) - { - throw new ArgumentException(Resources.PipingInput_AssessmentLevel_Cannot_set_to_NaN); - } - assessmentLevel = value; + assessmentLevel.Value = value.Value; } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs =================================================================== diff -u -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7 -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -223,15 +223,6 @@ } /// - /// Looks up a localized string similar to Toetspeil moet een geldige waarde hebben.. - /// - public static string PipingInput_AssessmentLevel_Cannot_set_to_NaN { - get { - return ResourceManager.GetString("PipingInput_AssessmentLevel_Cannot_set_to_NaN", resourceCulture); - } - } - - /// /// Looks up a localized string similar to De waarde voor het L-coördinaat van het intredepunt mag niet kleiner zijn dan 0.. /// public static string PipingInput_EntryPointL_Value_must_be_greater_than_or_equal_to_zero { Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx =================================================================== diff -u -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7 -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -192,9 +192,6 @@ Insteek sloot polderzijde - - Toetspeil moet een geldige waarde hebben. - Dijken - Piping Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7 -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -1056,6 +1056,15 @@ } /// + /// Looks up a localized string similar to Toetspeil moet een geldige waarde hebben.. + /// + public static string PipingInputContextProperties_AssessmentLevel_cannot_be_NaN { + get { + return ResourceManager.GetString("PipingInputContextProperties_AssessmentLevel_cannot_be_NaN", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kan locatie '{0}' niet gebruiken als invoer. {1}. /// public static string PipingInputContextProperties_HydraulicBoundaryLocation_Could_not_set_Location_0_Cause_1_ { Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx =================================================================== diff -u -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7 -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -601,4 +601,7 @@ Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer. + + Toetspeil moet een geldige waarde hebben. + \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs =================================================================== diff -u -r816d01207222c8359c772a9387a53784530d557a -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs (.../PipingInputContextProperties.cs) (revision 816d01207222c8359c772a9387a53784530d557a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs (.../PipingInputContextProperties.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -23,6 +23,8 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; + +using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; using Ringtoets.HydraRing.Data; @@ -79,7 +81,7 @@ } } - private double AssessmentLevel + private RoundedDouble AssessmentLevel { get { @@ -192,17 +194,15 @@ } set { - try + if (double.IsNaN(value.DesignWaterLevel)) { - data.WrappedData.AssessmentLevel = value.DesignWaterLevel; - } - catch (ArgumentException e) - { - string message = string.Format(Resources.PipingInputContextProperties_HydraulicBoundaryLocation_Could_not_set_Location_0_Cause_1_, - value.Name, - e.Message); + string message = string.Format(Resources.PipingInputContextProperties_HydraulicBoundaryLocation_Could_not_set_Location_0_Cause_1_, + value.Name, + Resources.PipingInputContextProperties_AssessmentLevel_cannot_be_NaN); throw new ArgumentException(message); } + + data.WrappedData.AssessmentLevel.Value = value.DesignWaterLevel; data.WrappedData.HydraulicBoundaryLocation = value; data.WrappedData.NotifyObservers(); } @@ -329,16 +329,12 @@ [ResourcesCategory(typeof(Resources), "Categories_Uplift")] [ResourcesDisplayName(typeof(Resources), "PipingInput_AssessmentLevel_DisplayName")] [ResourcesDescription(typeof(Resources), "PipingInput_AssessmentLevel_Description")] - public double AssessmentLevelUplift + public RoundedDouble AssessmentLevelUplift { get { return AssessmentLevel; } - set - { - AssessmentLevel = value; - } } [ResourcesCategory(typeof(Resources), "Categories_Uplift")] @@ -410,16 +406,12 @@ [ResourcesCategory(typeof(Resources), "Categories_Sellmeijer")] [ResourcesDisplayName(typeof(Resources), "PipingInput_AssessmentLevel_DisplayName")] [ResourcesDescription(typeof(Resources), "PipingInput_AssessmentLevel_Description")] - public double AssessmentLevelSellmeijer + public RoundedDouble AssessmentLevelSellmeijer { get { return AssessmentLevel; } - set - { - AssessmentLevel = value; - } } [TypeConverter(typeof(NormalDistributionDesignVariableTypeConverter))] Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs =================================================================== diff -u -re47cee04d169bb53197aeb1ce567f1a286217594 -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision e47cee04d169bb53197aeb1ce567f1a286217594) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Linq; +using Core.Common.Base.Data; + using NUnit.Framework; using Ringtoets.Piping.Calculation.TestUtil; @@ -216,7 +218,7 @@ // Setup PipingCalculatorInput input = new TestPipingInput { - AssessmentLevel = assessmentLevel, + AssessmentLevel = new RoundedDouble(2, assessmentLevel), PhreaticLevelExit = phreaticLevelExit, SellmeijerReductionFactor = sellmeijerReductionFactor, ThicknessCoverageLayer = thicknessCoverageLayer @@ -325,7 +327,7 @@ // Setup PipingCalculatorInput input = new TestPipingInput { - AssessmentLevel = 0, + AssessmentLevel = new RoundedDouble(2, 0), PhreaticLevelExit = 0, SellmeijerReductionFactor = 0, ThicknessCoverageLayer = 0 Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs =================================================================== diff -u -r9eb91cfa000697ddfdeace89aa8f1e959fc1f7f9 -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision 9eb91cfa000697ddfdeace89aa8f1e959fc1f7f9) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -1,5 +1,6 @@ using System; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Ringtoets.Piping.Data; @@ -10,7 +11,7 @@ { public double WaterVolumetricWeight; public double UpliftModelFactor; - public double AssessmentLevel; + public RoundedDouble AssessmentLevel; public double PiezometricHeadExit; public double DampingFactorExit; public double PhreaticLevelExit; @@ -40,7 +41,7 @@ { WaterVolumetricWeight = NextIncrementalDouble(); UpliftModelFactor = NextIncrementalDouble(); - AssessmentLevel = NextIncrementalDouble(); + AssessmentLevel = new RoundedDouble(2, NextIncrementalDouble()); PiezometricHeadExit = NextIncrementalDouble(); PhreaticLevelExit = NextIncrementalDouble(); DampingFactorExit = NextIncrementalDouble(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs =================================================================== diff -u -r816d01207222c8359c772a9387a53784530d557a -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 816d01207222c8359c772a9387a53784530d557a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -1,6 +1,7 @@ using System; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.TestUtil; using NUnit.Framework; @@ -72,7 +73,10 @@ Assert.IsNaN(inputParameters.ExitPointL); Assert.IsNaN(inputParameters.EntryPointL); - Assert.IsNaN(inputParameters.AssessmentLevel); + + Assert.IsInstanceOf(inputParameters.AssessmentLevel); + Assert.AreEqual(2, inputParameters.AssessmentLevel.NumberOfDecimalPlaces); + Assert.IsNaN(inputParameters.AssessmentLevel.Value); } [Test] @@ -88,19 +92,6 @@ } [Test] - public void AssessmentLevel_ValueIsNaN_ThrowsArgumentException() - { - // Setup - var pipingInput = new PipingInput(new GeneralPipingInput()); - - // Call - TestDelegate test = () => pipingInput.AssessmentLevel = double.NaN; - - // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Resources.PipingInput_AssessmentLevel_Cannot_set_to_NaN); - } - - [Test] [TestCase(0)] [TestCase(-1e-6)] [TestCase(-21)] Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs =================================================================== diff -u -r1c01ea681887e96b5b80fb7d23680a4eeac9bd50 -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs (.../PipingCalculationFactory.cs) (revision 1c01ea681887e96b5b80fb7d23680a4eeac9bd50) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs (.../PipingCalculationFactory.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -1,4 +1,6 @@ using System; + +using Core.Common.Base.Data; using Core.Common.Base.Geometry; namespace Ringtoets.Piping.Data.TestUtil @@ -32,7 +34,7 @@ { InputParameters = { - AssessmentLevel = 1.0, + AssessmentLevel = new RoundedDouble(2, 1.0), DampingFactorExit = { Mean = 1.0 Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -r816d01207222c8359c772a9387a53784530d557a -ra887863a3992744a394591e17072811eb9478ebc --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 816d01207222c8359c772a9387a53784530d557a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision a887863a3992744a394591e17072811eb9478ebc) @@ -1,5 +1,6 @@ using System; using System.Linq; + using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Common.Gui.PropertyBag; @@ -13,7 +14,6 @@ using Ringtoets.Piping.Data.Probabilistics; using Ringtoets.Piping.Forms.Extensions; using Ringtoets.Piping.Forms.PresentationObjects; -using Ringtoets.Piping.Forms.Properties; using Ringtoets.Piping.Forms.PropertyClasses; namespace Ringtoets.Piping.Forms.Test.PropertyClasses @@ -118,10 +118,13 @@ assessmentSectionMock) }; - // Call & Assert - const double assessmentLevel = 0.12; - properties.AssessmentLevelSellmeijer = assessmentLevel; - Assert.AreEqual(assessmentLevel, inputParameters.AssessmentLevel); + const double entryPointL = 0.12; + + // Call + properties.EntryPointL = entryPointL; + + // Assert + Assert.AreEqual(entryPointL, inputParameters.EntryPointL); mocks.VerifyAll(); } @@ -163,7 +166,6 @@ Enumerable.Empty(), Enumerable.Empty(), assessmentSectionMock), - AssessmentLevelSellmeijer = assessmentLevel, PiezometricHeadExitUplift = piezometricHeadExit, DampingFactorExitHeave = new LognormalDistributionDesignVariable(dampingFactorExit), PhreaticLevelExitHeave = new NormalDistributionDesignVariable(phreaticLevelExit), @@ -174,11 +176,12 @@ DarcyPermeability = new LognormalDistributionDesignVariable(darcyPermeability), ThicknessAquiferLayer = new LognormalDistributionDesignVariable(thicknessAquiferLayer), SurfaceLine = surfaceLine, - SoilProfile = soilProfile + SoilProfile = soilProfile, + HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(assessmentLevel) }; // Assert - Assert.AreEqual(assessmentLevel, inputParameters.AssessmentLevel); + Assert.AreEqual(assessmentLevel, inputParameters.AssessmentLevel, 1e-2); Assert.AreEqual(piezometricHeadExit, inputParameters.PiezometricHeadExit); Assert.AreEqual(dampingFactorExit, inputParameters.DampingFactorExit); Assert.AreEqual(phreaticLevelExit, inputParameters.PhreaticLevelExit); @@ -357,7 +360,10 @@ double assessmentLevel = new Random(21).NextDouble(); var inputParameters = new PipingInput(new GeneralPipingInput()) { - AssessmentLevel = assessmentLevel + AssessmentLevel = + { + Value = assessmentLevel + } }; inputParameters.Attach(projectObserver); @@ -375,15 +381,17 @@ DesignWaterLevel = double.NaN }; + double originalRoundedAssessmentLevel = inputParameters.AssessmentLevel; + // Call TestDelegate test = () => properties.HydraulicBoundaryLocation = hydraulicBoundaryLocation; // Assert var message = string.Format("Kan locatie '{0}' niet gebruiken als invoer. Toetspeil moet een geldige waarde hebben.", testName); TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, message); - Assert.AreEqual(assessmentLevel, properties.AssessmentLevelSellmeijer); - Assert.AreEqual(assessmentLevel, properties.AssessmentLevelUplift); + Assert.AreEqual(originalRoundedAssessmentLevel, properties.AssessmentLevelSellmeijer.Value); + Assert.AreEqual(originalRoundedAssessmentLevel, properties.AssessmentLevelUplift.Value); mocks.VerifyAll(); } @@ -419,8 +427,8 @@ properties.HydraulicBoundaryLocation = hydraulicBoundaryLocation; // Assert - Assert.AreEqual(testLevel, properties.AssessmentLevelSellmeijer); - Assert.AreEqual(testLevel, properties.AssessmentLevelUplift); + Assert.AreEqual(testLevel, properties.AssessmentLevelSellmeijer.Value, 1e-2); + Assert.AreEqual(testLevel, properties.AssessmentLevelUplift.Value, 1e-2); mocks.VerifyAll(); }