Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs =================================================================== diff -u -r7f45f1f08a4e6849984063d43bfecfd949b3c3fb -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision 7f45f1f08a4e6849984063d43bfecfd949b3c3fb) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -58,7 +58,7 @@ BreakWater = new BreakWater(BreakWaterType.Caisson, 0); criticalFlowRate = new LognormalDistribution(4) { - Mean = new RoundedDouble(4,0.004),StandardDeviation = new RoundedDouble(4,0.0006) + Mean = new RoundedDouble(4, 0.004), StandardDeviation = new RoundedDouble(4, 0.0006) }; DikeGeometry = Enumerable.Empty(); ForeshoreGeometry = Enumerable.Empty(); @@ -100,8 +100,8 @@ } set { - criticalFlowRate.Mean = value.Mean; - criticalFlowRate.StandardDeviation = value.StandardDeviation; + criticalFlowRate.Mean = value.Mean.ToPrecision(criticalFlowRate.Mean.NumberOfDecimalPlaces); + criticalFlowRate.StandardDeviation = value.StandardDeviation.ToPrecision(criticalFlowRate.StandardDeviation.NumberOfDecimalPlaces); } } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs =================================================================== diff -u --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs (revision 0) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -0,0 +1,74 @@ +// 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 Core.Common.Base.Data; +using Ringtoets.Common.Data.Probabilistics; + +namespace Ringtoets.HeightStructures.Data +{ + /// + /// Class that holds all static height structures calculation specific input parameters. + /// + public class GeneralHeightStructuresInput + { + /// + /// Initializes a new instance of the class. + /// + public GeneralHeightStructuresInput() + { + GravitationalAcceleration = new RoundedDouble(2, 9.87); + + ModelfactorOvertopping = new LognormalDistribution(3) + { + Mean = new RoundedDouble(3, 0.09), + StandardDeviation = new RoundedDouble(3, 0.06) + }; + + ModelFactorForStorageVolume = new LognormalDistribution(2) + { + Mean = new RoundedDouble(2, 1), + StandardDeviation = new RoundedDouble(2, 0.2) + }; + + ModelFactorForIncomingFlowVolume = new RoundedDouble(2, 1); + } + + /// + /// Gets the gravitational acceleration. + /// + public RoundedDouble GravitationalAcceleration { get; private set; } + + /// + /// Gets the model factor overtopping. + /// + public LognormalDistribution ModelfactorOvertopping { get; private set; } + + /// + /// Gets the model factor for storage volume. + /// + public LognormalDistribution ModelFactorForStorageVolume { get; private set; } + + /// + /// Gets the model factor for incoming flow volume. + /// + public RoundedDouble ModelFactorForIncomingFlowVolume { get; private set; } + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs =================================================================== diff -u -r47d80506f9f8166de93579dbba94e57f4101927b -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs (.../HeightStructuresCalculation.cs) (revision 47d80506f9f8166de93579dbba94e57f4101927b) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresCalculation.cs (.../HeightStructuresCalculation.cs) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -35,7 +35,7 @@ /// public HeightStructuresCalculation() { - InputParameters = new HeightStructuresInput(); + InputParameters = new HeightStructuresInput(new GeneralHeightStructuresInput()); Name = Resources.HeightStructuresCalculation_DefaultName; } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs =================================================================== diff -u -r20231cfee041a316978347564bd1fddbb41b9ffc -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs (.../HeightStructuresInput.cs) (revision 20231cfee041a316978347564bd1fddbb41b9ffc) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs (.../HeightStructuresInput.cs) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -19,13 +19,296 @@ // 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 Ringtoets.Common.Data.Probabilistics; +using Ringtoets.HydraRing.Data; namespace Ringtoets.HeightStructures.Data { /// /// Class that holds all height structures calculation specific input parameters. /// - public class HeightStructuresInput : Observable, ICalculationInput {} + public class HeightStructuresInput : Observable, ICalculationInput + { + private readonly NormalDistribution levelOfCrestOfStructure; + private readonly GeneralHeightStructuresInput generalInputParameters; + private readonly NormalDistribution modelfactorOvertoppingSuperCriticalFlow; + private readonly LognormalDistribution allowableIncreaseOfLevelForStorage; + private readonly LognormalDistribution storageStructureArea; + private readonly LognormalDistribution flowWidthAtBottomProtection; + private readonly LognormalDistribution criticalOvertoppingDischarge; + private RoundedDouble orientationOfTheNormalOfTheStructure; + private RoundedDouble failureProbabilityOfStructureGivenErosion; + private readonly NormalDistribution widthOfFlowApertures; + private RoundedDouble deviationOfTheWaveDirection; + private readonly LognormalDistribution stormDuration; + + /// + /// Creates a new instance of the class. + /// + /// General grass cover erosion inwards calculation input parameters that apply to each calculation. + /// When is null. + public HeightStructuresInput(GeneralHeightStructuresInput generalInputParameters) + { + if (generalInputParameters == null) + { + throw new ArgumentNullException("generalInputParameters"); + } + this.generalInputParameters = generalInputParameters; + + levelOfCrestOfStructure = new NormalDistribution(2) + { + StandardDeviation = new RoundedDouble(2, 0.05) + }; + + OrientationOfTheNormalOfTheStructure = new RoundedDouble(2); + + modelfactorOvertoppingSuperCriticalFlow = new NormalDistribution(2) + { + Mean = new RoundedDouble(2, 1.1), + StandardDeviation = new RoundedDouble(2, 0.03) + }; + + allowableIncreaseOfLevelForStorage = new LognormalDistribution(2) + { + StandardDeviation = new RoundedDouble(2, 0.1) + }; + + storageStructureArea = new LognormalDistribution(2) + { + StandardDeviation = new RoundedDouble(2, 0.1) + }; + + flowWidthAtBottomProtection = new LognormalDistribution(2) + { + StandardDeviation = new RoundedDouble(2, 0.05) + }; + + criticalOvertoppingDischarge = new LognormalDistribution(2) + { + StandardDeviation = new RoundedDouble(2, 0.15) + }; + + widthOfFlowApertures = new NormalDistribution(2) + { + StandardDeviation = new RoundedDouble(2, 0.05) + }; + + deviationOfTheWaveDirection = new RoundedDouble(2); + + stormDuration = new LognormalDistribution(2) + { + Mean = new RoundedDouble(2, 7.5), StandardDeviation = new RoundedDouble(2, 0.25) + }; + } + + #region Model Factors + + public NormalDistribution ModelfactorOvertoppingSuperCriticalFlow + { + get + { + return modelfactorOvertoppingSuperCriticalFlow; + } + set + { + modelfactorOvertoppingSuperCriticalFlow.Mean = value.Mean.ToPrecision(modelfactorOvertoppingSuperCriticalFlow.Mean.NumberOfDecimalPlaces); + } + } + + #endregion + + #region Hydraulic pressure + + /// + /// Gets or set the hydraulic boundary location from which to use the assessment level. + /// + public HydraulicBoundaryLocation HydraulicBoundaryLocation { get; set; } + + public RoundedDouble DeviationOfTheWaveDirection + { + get + { + return deviationOfTheWaveDirection; + } + set + { + deviationOfTheWaveDirection = value.ToPrecision(deviationOfTheWaveDirection.NumberOfDecimalPlaces); + } + } + + /// + /// Gets or sets the storm duration + /// + public LognormalDistribution StormDuration + { + get + { + return stormDuration; + } + set + { + stormDuration.Mean = value.Mean.ToPrecision(stormDuration.Mean.NumberOfDecimalPlaces); + } + } + + #endregion + + #region Schematisation + + public NormalDistribution LevelOfCrestOfStructure + { + get + { + return levelOfCrestOfStructure; + } + set + { + levelOfCrestOfStructure.Mean = value.Mean.ToPrecision(levelOfCrestOfStructure.Mean.NumberOfDecimalPlaces); + levelOfCrestOfStructure.StandardDeviation = value.StandardDeviation.ToPrecision(levelOfCrestOfStructure.StandardDeviation.NumberOfDecimalPlaces); + } + } + + public RoundedDouble OrientationOfTheNormalOfTheStructure + { + get + { + return orientationOfTheNormalOfTheStructure; + } + set + { + orientationOfTheNormalOfTheStructure = value.ToPrecision(orientationOfTheNormalOfTheStructure.NumberOfDecimalPlaces); + } + } + + public LognormalDistribution AllowableIncreaseOfLevelForStorage + { + get + { + return allowableIncreaseOfLevelForStorage; + } + set + { + allowableIncreaseOfLevelForStorage.Mean = value.Mean.ToPrecision(allowableIncreaseOfLevelForStorage.Mean.NumberOfDecimalPlaces); + allowableIncreaseOfLevelForStorage.StandardDeviation = value.StandardDeviation.ToPrecision(allowableIncreaseOfLevelForStorage.StandardDeviation.NumberOfDecimalPlaces); + } + } + + public LognormalDistribution StorageStructureArea + { + get + { + return storageStructureArea; + } + set + { + storageStructureArea.Mean = value.Mean.ToPrecision(storageStructureArea.Mean.NumberOfDecimalPlaces); + storageStructureArea.StandardDeviation = value.StandardDeviation.ToPrecision(storageStructureArea.StandardDeviation.NumberOfDecimalPlaces); + } + } + + public LognormalDistribution FlowWidthAtBottomProtection + { + get + { + return flowWidthAtBottomProtection; + } + set + { + flowWidthAtBottomProtection.Mean = value.Mean.ToPrecision(flowWidthAtBottomProtection.Mean.NumberOfDecimalPlaces); + flowWidthAtBottomProtection.StandardDeviation = value.StandardDeviation.ToPrecision(flowWidthAtBottomProtection.StandardDeviation.NumberOfDecimalPlaces); + } + } + + public LognormalDistribution CriticalOvertoppingDischarge + { + get + { + return criticalOvertoppingDischarge; + } + set + { + criticalOvertoppingDischarge.Mean = value.Mean.ToPrecision(criticalOvertoppingDischarge.Mean.NumberOfDecimalPlaces); + criticalOvertoppingDischarge.StandardDeviation = value.StandardDeviation.ToPrecision(criticalOvertoppingDischarge.StandardDeviation.NumberOfDecimalPlaces); + } + } + + public RoundedDouble FailureProbabilityOfStructureGivenErosion + { + get + { + return failureProbabilityOfStructureGivenErosion; + } + set + { + failureProbabilityOfStructureGivenErosion = value.ToPrecision(failureProbabilityOfStructureGivenErosion.NumberOfDecimalPlaces); + } + } + + public NormalDistribution WidthOfFlowApertures + { + get + { + return widthOfFlowApertures; + } + set + { + widthOfFlowApertures.Mean = value.Mean.ToPrecision(widthOfFlowApertures.Mean.NumberOfDecimalPlaces); + widthOfFlowApertures.StandardDeviation = value.StandardDeviation.ToPrecision(widthOfFlowApertures.StandardDeviation.NumberOfDecimalPlaces); + } + } + + #endregion + + #region General input parameters + + /// + /// Gets the gravitational acceleration. + /// + public RoundedDouble GravitationalAcceleration + { + get + { + return generalInputParameters.GravitationalAcceleration; + } + } + + /// + /// Gets the model factor overtopping. + /// + public LognormalDistribution ModelfactorOvertopping + { + get + { + return generalInputParameters.ModelfactorOvertopping; + } + } + + /// + /// Gets the model factor for storage volume. + /// + public LognormalDistribution ModelFactorForStorageVolume + { + get + { + return generalInputParameters.ModelFactorForStorageVolume; + } + } + + /// + /// Gets the model factor for incoming flow volume. + /// + public RoundedDouble ModelFactorForIncomingFlowVolume + { + get + { + return generalInputParameters.ModelFactorForIncomingFlowVolume; + } + } + + #endregion + } } \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/Ringtoets.HeightStructures.Data.csproj =================================================================== diff -u -re24eab2c6007074685556ec97dbe45940a520687 -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/Ringtoets.HeightStructures.Data.csproj (.../Ringtoets.HeightStructures.Data.csproj) (revision e24eab2c6007074685556ec97dbe45940a520687) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/Ringtoets.HeightStructures.Data.csproj (.../Ringtoets.HeightStructures.Data.csproj) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -39,6 +39,7 @@ Properties\GlobalAssembly.cs + @@ -66,6 +67,11 @@ Ringtoets.Common.Data False + + {70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2} + Ringtoets.HydraRing.Data + False + Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs =================================================================== diff -u --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs (revision 0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -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 Core.Common.Base.Data; +using NUnit.Framework; +using Ringtoets.Common.Data.Probabilistics; + +namespace Ringtoets.HeightStructures.Data.Test +{ + [TestFixture] + public class GeneralHeightStructuresInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var inputParameters = new GeneralHeightStructuresInput(); + + // Assert + Assert.AreEqual(9.87, inputParameters.GravitationalAcceleration, 1e-6); + + var modelfactorOvertopping = new NormalDistribution(3) + { + Mean = new RoundedDouble(3, 0.09), + StandardDeviation = new RoundedDouble(3, 0.06) + }; + Assert.AreEqual(modelfactorOvertopping.Mean, inputParameters.ModelfactorOvertopping.Mean, 1e-6); + Assert.AreEqual(modelfactorOvertopping.StandardDeviation, inputParameters.ModelfactorOvertopping.StandardDeviation, 1e-6); + + var modelFactorForStorageVolume = new NormalDistribution(2) + { + Mean = new RoundedDouble(2, 1.00), + StandardDeviation = new RoundedDouble(2, 0.20) + }; + Assert.AreEqual(modelFactorForStorageVolume.Mean, inputParameters.ModelFactorForStorageVolume.Mean, 1e-6); + Assert.AreEqual(modelFactorForStorageVolume.StandardDeviation, inputParameters.ModelFactorForStorageVolume.StandardDeviation, 1e-6); + + Assert.AreEqual(1, inputParameters.ModelFactorForIncomingFlowVolume, 1e-6); + } + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs =================================================================== diff -u -r47d80506f9f8166de93579dbba94e57f4101927b -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision 47d80506f9f8166de93579dbba94e57f4101927b) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -19,24 +19,154 @@ // 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 NUnit.Framework; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Data.TestUtil; namespace Ringtoets.HeightStructures.Data.Test { [TestFixture] public class HeightStructuresInputTest { [Test] + public void Constructor_NullGeneralInput_ThrowsArgumentNullException() + { + // Setup & Call + TestDelegate test = () => new HeightStructuresInput(null); + + // Assert + Assert.Throws(test); + } + + [Test] public void Constructor_DefaultPropertyValuesAreSet() { + // Setup + var generalInput = new GeneralHeightStructuresInput(); + // Call - var input = new HeightStructuresInput(); + var input = new HeightStructuresInput(generalInput); // Assert Assert.IsInstanceOf(input); Assert.IsInstanceOf(input); + Assert.IsNull(input.HydraulicBoundaryLocation); + + Assert.AreEqual(generalInput.GravitationalAcceleration, input.GravitationalAcceleration); + Assert.AreEqual(generalInput.ModelfactorOvertopping, input.ModelfactorOvertopping); + Assert.AreEqual(generalInput.ModelFactorForStorageVolume, input.ModelFactorForStorageVolume); + Assert.AreEqual(generalInput.ModelFactorForIncomingFlowVolume, input.ModelFactorForIncomingFlowVolume); + + Assert.AreEqual(0.05, input.LevelOfCrestOfStructure.StandardDeviation, input.LevelOfCrestOfStructure.StandardDeviation.GetAccuracy()); + Assert.AreEqual(1.1, input.ModelfactorOvertoppingSuperCriticalFlow.Mean, input.ModelfactorOvertoppingSuperCriticalFlow.Mean.GetAccuracy()); + Assert.AreEqual(0.03, input.ModelfactorOvertoppingSuperCriticalFlow.StandardDeviation, input.ModelfactorOvertoppingSuperCriticalFlow.StandardDeviation.GetAccuracy()); + Assert.AreEqual(0.1, input.AllowableIncreaseOfLevelForStorage.StandardDeviation, input.AllowableIncreaseOfLevelForStorage.StandardDeviation.GetAccuracy()); + Assert.AreEqual(0.1, input.StorageStructureArea.StandardDeviation, input.StorageStructureArea.StandardDeviation.GetAccuracy()); + Assert.AreEqual(0.05, input.FlowWidthAtBottomProtection.StandardDeviation, input.FlowWidthAtBottomProtection.StandardDeviation.GetAccuracy()); + Assert.AreEqual(0.15, input.CriticalOvertoppingDischarge.StandardDeviation, input.CriticalOvertoppingDischarge.StandardDeviation.GetAccuracy()); + Assert.AreEqual(0.05, input.WidthOfFlowApertures.StandardDeviation, input.WidthOfFlowApertures.StandardDeviation.GetAccuracy()); + Assert.AreEqual(7.5, input.StormDuration.Mean, input.StormDuration.Mean.GetAccuracy()); + Assert.AreEqual(0.25, input.StormDuration.StandardDeviation, input.StormDuration.StandardDeviation.GetAccuracy()); } + + [Test] + public void Properties_ExpectedValues() + { + // Setup + var generalInput = new GeneralHeightStructuresInput(); + var input = new HeightStructuresInput(generalInput); + var random = new Random(22); + + NormalDistribution levelOfCrestOfStructure = new NormalDistribution(2); + RoundedDouble defaultModelfactorOvertoppingSupercriticalFlowStandardDeviation = input.ModelfactorOvertoppingSuperCriticalFlow.StandardDeviation; + NormalDistribution modelfactorOvertoppingSupercriticalFlow = new NormalDistribution(2) + { + Mean = new RoundedDouble(5, random.NextDouble()), + StandardDeviation = new RoundedDouble(2, random.NextDouble()) + }; + + var orientationOfTheNormalOfTheStructure = new RoundedDouble(5, random.NextDouble()); + var allowableIncreaseOfLevelForStorage = new LognormalDistribution(2) + { + Mean = new RoundedDouble(2, random.NextDouble()), + StandardDeviation = new RoundedDouble(2, random.NextDouble()) + }; + var storageStructureArea = new LognormalDistribution(2) + { + Mean = new RoundedDouble(2, random.NextDouble()), + StandardDeviation = new RoundedDouble(2, random.NextDouble()) + }; + var flowWidthAtBottomProtection = new LognormalDistribution(2) + { + Mean = new RoundedDouble(2, random.NextDouble()), + StandardDeviation = new RoundedDouble(2, random.NextDouble()) + }; + var criticalOvertoppingDischarge = new LognormalDistribution(2) + { + Mean = new RoundedDouble(2, random.NextDouble()), + StandardDeviation = new RoundedDouble(2, random.NextDouble()) + }; + var failureProbabilityOfStructureGivenErosion = new RoundedDouble(5, random.NextDouble()); + var widthOfFlowApertures = new NormalDistribution(2) + { + Mean = new RoundedDouble(2, random.NextDouble()), + StandardDeviation = new RoundedDouble(2, random.NextDouble()) + }; + var deviationOfTheWaveDirection = new RoundedDouble(5, random.NextDouble()); + RoundedDouble defaultStormDuration = input.StormDuration.StandardDeviation; + var stormDuration = new LognormalDistribution(2) + { + Mean = new RoundedDouble(2, random.NextDouble()), + StandardDeviation = new RoundedDouble(2, random.NextDouble()) + }; + + // Call + input.LevelOfCrestOfStructure = levelOfCrestOfStructure; + input.OrientationOfTheNormalOfTheStructure = orientationOfTheNormalOfTheStructure; + input.ModelfactorOvertoppingSuperCriticalFlow = modelfactorOvertoppingSupercriticalFlow; + input.AllowableIncreaseOfLevelForStorage = allowableIncreaseOfLevelForStorage; + input.StorageStructureArea = storageStructureArea; + input.FlowWidthAtBottomProtection = flowWidthAtBottomProtection; + input.CriticalOvertoppingDischarge = criticalOvertoppingDischarge; + input.FailureProbabilityOfStructureGivenErosion = failureProbabilityOfStructureGivenErosion; + input.WidthOfFlowApertures = widthOfFlowApertures; + input.DeviationOfTheWaveDirection = deviationOfTheWaveDirection; + input.StormDuration = stormDuration; + + // Assert + Assert.AreEqual(levelOfCrestOfStructure.Mean, input.LevelOfCrestOfStructure.Mean); + Assert.AreEqual(levelOfCrestOfStructure.StandardDeviation, input.LevelOfCrestOfStructure.StandardDeviation); + + Assert.AreEqual(modelfactorOvertoppingSupercriticalFlow.Mean, input.ModelfactorOvertoppingSuperCriticalFlow.Mean); + Assert.AreEqual(defaultModelfactorOvertoppingSupercriticalFlowStandardDeviation, input.ModelfactorOvertoppingSuperCriticalFlow.StandardDeviation); + + Assert.AreEqual(orientationOfTheNormalOfTheStructure, input.OrientationOfTheNormalOfTheStructure, input.OrientationOfTheNormalOfTheStructure.GetAccuracy()); + + Assert.AreEqual(allowableIncreaseOfLevelForStorage.Mean, input.AllowableIncreaseOfLevelForStorage.Mean); + Assert.AreEqual(allowableIncreaseOfLevelForStorage.StandardDeviation, input.AllowableIncreaseOfLevelForStorage.StandardDeviation); + + Assert.AreEqual(storageStructureArea.Mean, input.StorageStructureArea.Mean); + Assert.AreEqual(storageStructureArea.StandardDeviation, input.StorageStructureArea.StandardDeviation); + + Assert.AreEqual(flowWidthAtBottomProtection.Mean, input.FlowWidthAtBottomProtection.Mean); + Assert.AreEqual(flowWidthAtBottomProtection.StandardDeviation, input.FlowWidthAtBottomProtection.StandardDeviation); + + Assert.AreEqual(criticalOvertoppingDischarge.Mean, input.CriticalOvertoppingDischarge.Mean); + Assert.AreEqual(criticalOvertoppingDischarge.StandardDeviation, input.CriticalOvertoppingDischarge.StandardDeviation); + + Assert.AreEqual(failureProbabilityOfStructureGivenErosion, input.FailureProbabilityOfStructureGivenErosion, input.FailureProbabilityOfStructureGivenErosion.GetAccuracy()); + + Assert.AreEqual(widthOfFlowApertures.Mean, input.WidthOfFlowApertures.Mean); + Assert.AreEqual(widthOfFlowApertures.StandardDeviation, input.WidthOfFlowApertures.StandardDeviation); + + Assert.AreEqual(deviationOfTheWaveDirection, input.DeviationOfTheWaveDirection, input.DeviationOfTheWaveDirection.GetAccuracy()); + + Assert.AreEqual(stormDuration.Mean, input.StormDuration.Mean); + Assert.AreEqual(defaultStormDuration, input.StormDuration.StandardDeviation); + } } -} +} \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/Ringtoets.HeightStructures.Data.Test.csproj =================================================================== diff -u -re24eab2c6007074685556ec97dbe45940a520687 -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/Ringtoets.HeightStructures.Data.Test.csproj (.../Ringtoets.HeightStructures.Data.Test.csproj) (revision e24eab2c6007074685556ec97dbe45940a520687) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/Ringtoets.HeightStructures.Data.Test.csproj (.../Ringtoets.HeightStructures.Data.Test.csproj) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -49,6 +49,7 @@ + @@ -71,6 +72,14 @@ {D4200F43-3F72-4F42-AF0A-8CED416A38EC} Ringtoets.Common.Data + + {4843d6e5-066f-4795-94f5-1d53932dd03c} + Ringtoets.Common.Data.TestUtil + + + {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2} + Ringtoets.HydraRing.Data + {1C0017D8-35B5-4CA0-8FC7-A83F46DBDC99} Ringtoets.HeightStructures.Data Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresInputContextTest.cs =================================================================== diff -u -r80dce3e20a58c31ec56ee8ee734a1127b9a0cb28 -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresInputContextTest.cs (.../HeightStructuresInputContextTest.cs) (revision 80dce3e20a58c31ec56ee8ee734a1127b9a0cb28) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresInputContextTest.cs (.../HeightStructuresInputContextTest.cs) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -46,18 +46,18 @@ public void ConstructorWithData_Always_ExpectedPropertiesSet() { // Setup - var inputMock = mocksRepository.StrictMock(); + var input = new HeightStructuresInput(new GeneralHeightStructuresInput()); var calculationMock = mocksRepository.StrictMock(); var failureMechanismMock = mocksRepository.StrictMock(); var assessmentSectionMock = mocksRepository.StrictMock(); mocksRepository.ReplayAll(); // Call - var context = new HeightStructuresInputContext(inputMock, calculationMock, failureMechanismMock, assessmentSectionMock); + var context = new HeightStructuresInputContext(input, calculationMock, failureMechanismMock, assessmentSectionMock); // Assert Assert.IsInstanceOf>(context); - Assert.AreEqual(inputMock, context.WrappedData); + Assert.AreEqual(input, context.WrappedData); Assert.AreEqual(calculationMock, context.Calculation); Assert.AreEqual(failureMechanismMock, context.FailureMechanism); Assert.AreEqual(assessmentSectionMock, context.AssessmentSection); @@ -68,13 +68,13 @@ public void Constructor_NullCalculation_ThrowsArgumentNullException() { // Setup - var inputMock = mocksRepository.StrictMock(); + var input = new HeightStructuresInput(new GeneralHeightStructuresInput()); var failureMechanismMock = mocksRepository.StrictMock(); var assessmentSectionMock = mocksRepository.StrictMock(); mocksRepository.ReplayAll(); // Call - TestDelegate test = () => new HeightStructuresInputContext(inputMock, null, failureMechanismMock, assessmentSectionMock); + TestDelegate test = () => new HeightStructuresInputContext(input, null, failureMechanismMock, assessmentSectionMock); // Assert var message = String.Format(Resources.HeightStructuresContext_AssertInputsAreNotNull_DataDescription_0_cannot_be_null, Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs =================================================================== diff -u -r80dce3e20a58c31ec56ee8ee734a1127b9a0cb28 -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision 80dce3e20a58c31ec56ee8ee734a1127b9a0cb28) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresInputContextTreeNodeInfoTest.cs (.../HeightStructuresInputContextTreeNodeInfoTest.cs) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) @@ -80,7 +80,7 @@ // Setup var assessmentSectionMock = mocksRepository.StrictMock(); var heightStructuresInputContext = new HeightStructuresInputContext( - new HeightStructuresInput(), + new HeightStructuresInput(new GeneralHeightStructuresInput()), new HeightStructuresCalculation(), new HeightStructuresFailureMechanism(), assessmentSectionMock); @@ -101,7 +101,7 @@ // Setup var assessmentSectionMock = mocksRepository.StrictMock(); var heightStructuresInputContext = new HeightStructuresInputContext( - new HeightStructuresInput(), + new HeightStructuresInput(new GeneralHeightStructuresInput()), new HeightStructuresCalculation(), new HeightStructuresFailureMechanism(), assessmentSectionMock); @@ -143,4 +143,4 @@ mocksRepository.VerifyAll(); } } -} +} \ No newline at end of file