Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsOutput.cs =================================================================== diff -u -rc56b400b7b67a827670f260756990a80bd77c5c7 -r5cb1e84934857c8ac82e41690e7b6fc510d01927 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsOutput.cs (.../WaveConditionsOutput.cs) (revision c56b400b7b67a827670f260756990a80bd77c5c7) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsOutput.cs (.../WaveConditionsOutput.cs) (revision 5cb1e84934857c8ac82e41690e7b6fc510d01927) @@ -19,9 +19,13 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using System.ComponentModel; using Core.Common.Base; using Core.Common.Base.Data; +using Core.Common.Utils; using Ringtoets.Common.Data.Calculation; +using Ringtoets.HydraRing.Data; namespace Ringtoets.Revetment.Data { @@ -30,40 +34,95 @@ /// public class WaveConditionsOutput : Observable, ICalculationOutput { + private CalculationConvergence calculationConvergence; + /// /// Creates a new instance of . /// /// The water level for which the calculation has been performed. /// The calculated wave height. /// The calculated wave peak period. - /// The calculated wave angle. - /// All provided output values will be rounded to 2 decimals. - public WaveConditionsOutput(double waterLevel, double waveHeight, double wavePeakPeriod, double waveAngle) + /// The calculated wave angle with respect to the dike normal. + /// The calculated wave direction with respect to North. + /// The return period. + /// The calculated beta. + /// All provided output values will be rounded to 2 decimals, except for + /// and . + public WaveConditionsOutput(double waterLevel, double waveHeight, double wavePeakPeriod, double waveAngle, + double waveDirection = double.NaN, double returnPeriod = double.NaN, double calculatedReliability = double.NaN) { WaterLevel = new RoundedDouble(2, waterLevel); WaveHeight = new RoundedDouble(2, waveHeight); WavePeakPeriod = new RoundedDouble(2, wavePeakPeriod); WaveAngle = new RoundedDouble(2, waveAngle); + WaveDirection = new RoundedDouble(2, waveDirection); + + TargetReliability = StatisticsConverter.ReturnPeriodToReliability(returnPeriod); + CalculatedReliability = calculatedReliability; } /// /// Gets the water level for which the calculation has been performed. + /// [m+NAP] /// public RoundedDouble WaterLevel { get; private set; } /// /// Gets the calculated wave height. + /// [m] /// public RoundedDouble WaveHeight { get; private set; } /// /// Gets the calculated wave peak period. + /// [s] /// public RoundedDouble WavePeakPeriod { get; private set; } /// - /// Gets the calculated wave angle. + /// Gets the calculated wave angle with respect to the dike normal. + /// [deg] /// public RoundedDouble WaveAngle { get; private set; } + + /// + /// Gets the calculated wave direction with respect to North. + /// [deg] + /// + public RoundedDouble WaveDirection { get; private set; } + + /// + /// Gets the target beta. + /// [-] + /// + public double TargetReliability { get; private set; } + + /// + /// Gets the calculated beta. + /// [-] + /// + public double CalculatedReliability { get; private set; } + + /// + /// Gets or sets the convergence status of the calculation. + /// + /// Thrown when attempting to set invalid enum value + /// of type . + public CalculationConvergence CalculationConvergence + { + get + { + return calculationConvergence; + } + set + { + if (!Enum.IsDefined(typeof(CalculationConvergence), value)) + { + throw new InvalidEnumArgumentException("CalculationConvergence", (int) value, typeof(CalculationConvergence)); + } + + calculationConvergence = value; + } + } } } \ No newline at end of file Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r704dc1639be4263af3e09b8533e1ea3b065b012c -r5cb1e84934857c8ac82e41690e7b6fc510d01927 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 704dc1639be4263af3e09b8533e1ea3b065b012c) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5cb1e84934857c8ac82e41690e7b6fc510d01927) @@ -298,6 +298,96 @@ } /// + /// Looks up a localized string similar to De berekende kans van voorkomen van het berekende resultaat.. + /// + public static string WaveConditionsOutput_CalculatedProbability_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_CalculatedProbability_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Berekende kans [1/jaar]. + /// + public static string WaveConditionsOutput_CalculatedProbability_DisplayName { + get { + return ResourceManager.GetString("WaveConditionsOutput_CalculatedProbability_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.. + /// + public static string WaveConditionsOutput_CalculatedReliability_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_CalculatedReliability_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Betrouwbaarheidsindex berekende kans [-]. + /// + public static string WaveConditionsOutput_CalculatedReliability_DisplayName { + get { + return ResourceManager.GetString("WaveConditionsOutput_CalculatedReliability_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Is convergentie bereikt voor de berekening?. + /// + public static string WaveConditionsOutput_Convergence_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_Convergence_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Convergentie. + /// + public static string WaveConditionsOutput_Convergence_DisplayName { + get { + return ResourceManager.GetString("WaveConditionsOutput_Convergence_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De ingevoerde kans waarvoor het resultaat moet worden berekend.. + /// + public static string WaveConditionsOutput_TargetProbability_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_TargetProbability_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Doelkans [1/jaar]. + /// + public static string WaveConditionsOutput_TargetProbability_DisplayName { + get { + return ResourceManager.GetString("WaveConditionsOutput_TargetProbability_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.. + /// + public static string WaveConditionsOutput_TargetReliability_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_TargetReliability_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Betrouwbaarheidsindex doelkans [-]. + /// + public static string WaveConditionsOutput_TargetReliability_DisplayName { + get { + return ResourceManager.GetString("WaveConditionsOutput_TargetReliability_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De waterstand waarvoor de golfhoogte, -periode en -richting zijn berekend.. /// public static string WaveConditionsOutput_WaterLevel_Description { @@ -316,7 +406,7 @@ } /// - /// Looks up a localized string similar to Berekende golfrichting ten opzichte van dijknormaal.. + /// Looks up a localized string similar to Berekende maatgevende golfrichting ten opzichte van de dijknormaal.. /// public static string WaveConditionsOutput_WaveAngle_Description { get { @@ -325,7 +415,7 @@ } /// - /// Looks up a localized string similar to Golfrichting [°]. + /// Looks up a localized string similar to Golfrichting t.o.v. dijknormaal [°]. /// public static string WaveConditionsOutput_WaveAngle_DisplayName { get { @@ -334,6 +424,24 @@ } /// + /// Looks up a localized string similar to Berekende maatgevende golfrichting ten opzichte van het noorden.. + /// + public static string WaveConditionsOutput_WaveDirection_Description { + get { + return ResourceManager.GetString("WaveConditionsOutput_WaveDirection_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Golfrichting t.o.v. Noord [°]. + /// + public static string WaveConditionsOutput_WaveDirection_DisplayName { + get { + return ResourceManager.GetString("WaveConditionsOutput_WaveDirection_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Berekende golfhoogte.. /// public static string WaveConditionsOutput_WaveHeight_Description { Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx =================================================================== diff -u -r704dc1639be4263af3e09b8533e1ea3b065b012c -r5cb1e84934857c8ac82e41690e7b6fc510d01927 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx (.../Resources.resx) (revision 704dc1639be4263af3e09b8533e1ea3b065b012c) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/Properties/Resources.resx (.../Resources.resx) (revision 5cb1e84934857c8ac82e41690e7b6fc510d01927) @@ -189,18 +189,54 @@ Waterstanden in berekening [m+NAP] + + De berekende kans van voorkomen van het berekende resultaat. + + + Berekende kans [1/jaar] + + + Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat. + + + Betrouwbaarheidsindex berekende kans [-] + + + Is convergentie bereikt voor de berekening? + + + Convergentie + + + De ingevoerde kans waarvoor het resultaat moet worden berekend. + + + Doelkans [1/jaar] + + + Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend. + + + Betrouwbaarheidsindex doelkans [-] + De waterstand waarvoor de golfhoogte, -periode en -richting zijn berekend. Waterstand [m+NAP] - Berekende golfrichting ten opzichte van dijknormaal. + Berekende maatgevende golfrichting ten opzichte van de dijknormaal. - Golfrichting [°] + Golfrichting t.o.v. dijknormaal [°] + + Berekende maatgevende golfrichting ten opzichte van het noorden. + + + Golfrichting t.o.v. Noord [°] + Berekende golfhoogte. Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsOutputProperties.cs =================================================================== diff -u -rd06a4ba54fc0abe9dcf1d1c8a93785a907132843 -r5cb1e84934857c8ac82e41690e7b6fc510d01927 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsOutputProperties.cs (.../WaveConditionsOutputProperties.cs) (revision d06a4ba54fc0abe9dcf1d1c8a93785a907132843) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsOutputProperties.cs (.../WaveConditionsOutputProperties.cs) (revision 5cb1e84934857c8ac82e41690e7b6fc510d01927) @@ -22,8 +22,11 @@ using System.ComponentModel; using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; +using Core.Common.Utils; using Core.Common.Utils.Attributes; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.TypeConverters; +using Ringtoets.HydraRing.Data; using Ringtoets.Revetment.Data; using Ringtoets.Revetment.Forms.Properties; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -74,6 +77,18 @@ [TypeConverter(typeof(NoValueRoundedDoubleConverter))] [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_WaveDirection_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_WaveDirection_Description")] + public RoundedDouble WaveDirection + { + get + { + return data.WaveDirection; + } + } + + [TypeConverter(typeof(NoValueRoundedDoubleConverter))] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_WaveAngle_DisplayName")] [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_WaveAngle_Description")] public RoundedDouble WaveAngle @@ -84,6 +99,63 @@ } } + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_TargetProbability_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_TargetProbability_Description")] + public string TargetProbability + { + get + { + double probability = StatisticsConverter.ReliabilityToProbability(data.TargetReliability); + return ProbabilityFormattingHelper.Format(probability); + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_TargetReliability_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_TargetReliability_Description")] + public RoundedDouble TargetReliability + { + get + { + return new RoundedDouble(3, data.TargetReliability); + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_CalculatedProbability_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_CalculatedProbability_Description")] + public string CalculatedProbability + { + get + { + double probability = StatisticsConverter.ReliabilityToProbability(data.CalculatedReliability); + return ProbabilityFormattingHelper.Format(probability); + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_CalculatedReliability_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_CalculatedReliability_Description")] + public RoundedDouble CalculatedReliability + { + get + { + return new RoundedDouble(3, data.CalculatedReliability); + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "WaveConditionsOutput_Convergence_DisplayName")] + [ResourcesDescription(typeof(Resources), "WaveConditionsOutput_Convergence_Description")] + public string Convergence + { + get + { + return new EnumDisplayWrapper(data.CalculationConvergence).DisplayName; + } + } + public override string ToString() { return string.Empty; Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs =================================================================== diff -u -rcd7078972189cf51d899754097ef3cbc0ddc26ee -r5cb1e84934857c8ac82e41690e7b6fc510d01927 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs (.../WaveConditionsCalculationServiceBase.cs) (revision cd7078972189cf51d899754097ef3cbc0ddc26ee) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs (.../WaveConditionsCalculationServiceBase.cs) (revision 5cb1e84934857c8ac82e41690e7b6fc510d01927) @@ -228,10 +228,15 @@ { calculator.Calculate(calculationInput); - return new WaveConditionsOutput(waterLevel, - calculator.WaveHeight, - calculator.WavePeakPeriod, - calculator.WaveAngle); + var output = new WaveConditionsOutput(waterLevel, + calculator.WaveHeight, + calculator.WavePeakPeriod, + calculator.WaveAngle, + calculator.WaveDirection, + returnPeriod, + calculator.ReliabilityIndex); + output.CalculationConvergence = RingtoetsCommonDataCalculationService.CalculationConverged(calculator.ReliabilityIndex, returnPeriod); + return output; } catch (HydraRingFileParserException) { Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsOutputTest.cs =================================================================== diff -u -rfb6c8cb473282ccd9b920afddb33a2284c7274cd -r5cb1e84934857c8ac82e41690e7b6fc510d01927 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsOutputTest.cs (.../WaveConditionsOutputTest.cs) (revision fb6c8cb473282ccd9b920afddb33a2284c7274cd) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsOutputTest.cs (.../WaveConditionsOutputTest.cs) (revision 5cb1e84934857c8ac82e41690e7b6fc510d01927) @@ -19,10 +19,15 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using System.ComponentModel; using Core.Common.Base; +using Core.Common.TestUtil; +using Core.Common.Utils; using NUnit.Framework; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.HydraRing.Data; namespace Ringtoets.Revetment.Data.Test { @@ -37,9 +42,15 @@ const double waveHeight = 4.29884; const double wavePeakPeriod = 0.19435; const double waveAngle = 180.62353; + const double waveDirection = 230.67893; + const double returnPeriod = 6000000; + var random = new Random(21); + double calculatedBeta = random.NextDouble(); + // Call - var output = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle); + var output = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle, waveDirection, returnPeriod, + calculatedBeta); // Assert Assert.IsInstanceOf(output); @@ -48,6 +59,65 @@ Assert.AreEqual(waveHeight, output.WaveHeight, output.WaveHeight.GetAccuracy()); Assert.AreEqual(wavePeakPeriod, output.WavePeakPeriod, output.WavePeakPeriod.GetAccuracy()); Assert.AreEqual(waveAngle, output.WaveAngle, output.WaveAngle.GetAccuracy()); + Assert.AreEqual(waveDirection, output.WaveDirection, output.WaveDirection.GetAccuracy()); + + Assert.AreEqual(StatisticsConverter.ReturnPeriodToReliability(returnPeriod), output.TargetReliability); + Assert.AreEqual(calculatedBeta, output.CalculatedReliability); + Assert.AreEqual(CalculationConvergence.NotCalculated, output.CalculationConvergence); } + + [Test] + [TestCase(CalculationConvergence.NotCalculated)] + [TestCase(CalculationConvergence.CalculatedConverged)] + [TestCase(CalculationConvergence.CalculatedNotConverged)] + public void CalculationConvergence_ValidValues_SetsCalculationConvergence(CalculationConvergence convergence) + { + // Setup + const double waterLevel = 3.09378; + const double waveHeight = 4.29884; + const double wavePeakPeriod = 0.19435; + const double waveAngle = 180.62353; + const double waveDirection = 230.67893; + + var random = new Random(21); + double returnPeriod = random.NextDouble(); + double calculatedBeta = random.NextDouble(); + + var output = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle, waveDirection, returnPeriod, + calculatedBeta); + + // Call + output.CalculationConvergence = convergence; + + // Assert + Assert.AreEqual(convergence, output.CalculationConvergence); + } + + [Test] + public void CalculationConvergence_Invalidvalue_ThrowsInvalidEnumArgumentException() + { + // Setup + const double waterLevel = 3.09378; + const double waveHeight = 4.29884; + const double wavePeakPeriod = 0.19435; + const double waveAngle = 180.62353; + const double waveDirection = 230.67893; + const double returnPeriod = 6000000; + + var random = new Random(21); + double calculatedBeta = random.NextDouble(); + + var output = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle, waveDirection, returnPeriod, + calculatedBeta); + + // Call + TestDelegate call = () => output.CalculationConvergence = (CalculationConvergence) 9001; + + // Assert + const string expectedMessage = "The value of argument 'CalculationConvergence' (9001) is invalid for Enum type 'CalculationConvergence'."; + string paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, + expectedMessage).ParamName; + Assert.AreEqual("CalculationConvergence", paramName); + } } } \ No newline at end of file Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsOutputPropertiesTest.cs =================================================================== diff -u -r7126410c2fc1844718e4592a6088282cc7415a79 -r5cb1e84934857c8ac82e41690e7b6fc510d01927 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsOutputPropertiesTest.cs (.../WaveConditionsOutputPropertiesTest.cs) (revision 7126410c2fc1844718e4592a6088282cc7415a79) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsOutputPropertiesTest.cs (.../WaveConditionsOutputPropertiesTest.cs) (revision 5cb1e84934857c8ac82e41690e7b6fc510d01927) @@ -22,8 +22,11 @@ using System; using System.ComponentModel; using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using Core.Common.Utils; using NUnit.Framework; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.Helpers; using Ringtoets.Revetment.Data; using Ringtoets.Revetment.Forms.PropertyClasses; @@ -35,7 +38,13 @@ private const int requiredWaterLevelPropertyIndex = 0; private const int requiredWaveHeightPropertyIndex = 1; private const int requiredWavePeakPeriodPropertyIndex = 2; - private const int requiredWaveAnglePropertyIndex = 3; + private const int requiredWaveDirectionPropertyIndex = 3; + private const int requiredWaveAnglePropertyIndex = 4; + private const int requiredTargetProbabilityPropertyIndex = 5; + private const int requiredTargetReliabilityPropertyIndex = 6; + private const int requiredCalculatedProbabilityPropertyIndex = 7; + private const int requiredCalculatedReliabilityPropertyIndex = 8; + private const int requiredConvergencePropertyIndex = 9; [Test] public void GetProperties_ValidData_ReturnsExpectedValues() @@ -45,18 +54,36 @@ const double waveHeight = 4.29884; const double wavePeakPeriod = 0.19435; const double waveAngle = 180.62353; + const double waveDirection = 230.5326; + const double returnPeriod = 3000; + const double calculatedBeta = 67.856; // Call var properties = new WaveConditionsOutputProperties { - Data = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle) + Data = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle, waveDirection, returnPeriod, + calculatedBeta) }; // Assert Assert.AreEqual(waterLevel, properties.WaterLevel, properties.WaterLevel.GetAccuracy()); Assert.AreEqual(waveHeight, properties.WaveHeight, properties.WaveHeight.GetAccuracy()); Assert.AreEqual(wavePeakPeriod, properties.WavePeakPeriod, properties.WavePeakPeriod.GetAccuracy()); Assert.AreEqual(waveAngle, properties.WaveAngle, properties.WaveAngle.GetAccuracy()); + Assert.AreEqual(waveDirection, properties.WaveDirection, properties.WaveDirection.GetAccuracy()); + + const double accuracy = 1e-3; + double expectedTargetReliability = StatisticsConverter.ReturnPeriodToReliability(returnPeriod); + double targetProbability = StatisticsConverter.ReliabilityToProbability(expectedTargetReliability); + + Assert.AreEqual(ProbabilityFormattingHelper.Format(targetProbability), properties.TargetProbability); + Assert.AreEqual(expectedTargetReliability, properties.TargetReliability, accuracy); + + double expectedCalculatedProbability = StatisticsConverter.ReliabilityToProbability(calculatedBeta); + Assert.AreEqual(ProbabilityFormattingHelper.Format(expectedCalculatedProbability), properties.CalculatedProbability); + Assert.AreEqual(calculatedBeta, properties.CalculatedReliability, accuracy); + + Assert.AreEqual(string.Empty, properties.Convergence); } [Test] @@ -67,22 +94,15 @@ const double waveHeight = 4.29884; const double wavePeakPeriod = 0.19435; const double waveAngle = 180.62353; + const double waveDirection = 230.5326; + const double returnPeriod = 3000; + const double calculatedBeta = 67.856; - const string expectedCategory = "Algemeen"; - const string expectedWaterLevelDisplayName = "Waterstand [m+NAP]"; - const string expectedWaveHeightDisplayName = "Golfhoogte (Hs) [m]"; - const string expectedWavePeakPeriodDisplayName = "Golfperiode (Tp) [s]"; - const string expectedWaveAngleDisplayName = "Golfrichting [°]"; - - const string expectedWaterLevelDescription = "De waterstand waarvoor de golfhoogte, -periode en -richting zijn berekend."; - const string expectedWaveHeightDescription = "Berekende golfhoogte."; - const string expectedWavePeakPeriodDescription = "Berekende golfperiode."; - const string expectedWaveAngleDescription = "Berekende golfrichting ten opzichte van dijknormaal."; - // Call var properties = new WaveConditionsOutputProperties { - Data = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle) + Data = new WaveConditionsOutput(waterLevel, waveHeight, wavePeakPeriod, waveAngle, waveDirection, returnPeriod, + calculatedBeta) }; // Assert @@ -94,36 +114,87 @@ new BrowsableAttribute(true) }); - Assert.AreEqual(4, dynamicProperties.Count); + Assert.AreEqual(10, dynamicProperties.Count); Assert.IsInstanceOf(classTypeConverter); PropertyDescriptor waterLevelProperty = dynamicProperties[requiredWaterLevelPropertyIndex]; Assert.IsNotNull(waterLevelProperty); - Assert.IsTrue(waterLevelProperty.IsReadOnly); - Assert.AreEqual(expectedCategory, waterLevelProperty.Category); - Assert.AreEqual(expectedWaterLevelDisplayName, waterLevelProperty.DisplayName); - Assert.AreEqual(expectedWaterLevelDescription, waterLevelProperty.Description); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waterLevelProperty, + "Algemeen", + "Waterstand [m+NAP]", + "De waterstand waarvoor de golfhoogte, -periode en -richting zijn berekend.", + true); PropertyDescriptor waveHeightProperty = dynamicProperties[requiredWaveHeightPropertyIndex]; Assert.IsNotNull(waveHeightProperty); - Assert.IsTrue(waveHeightProperty.IsReadOnly); - Assert.AreEqual(expectedCategory, waveHeightProperty.Category); - Assert.AreEqual(expectedWaveHeightDisplayName, waveHeightProperty.DisplayName); - Assert.AreEqual(expectedWaveHeightDescription, waveHeightProperty.Description); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveHeightProperty, + "Algemeen", + "Golfhoogte (Hs) [m]", + "Berekende golfhoogte.", + true); PropertyDescriptor wavePeakPeriodProperty = dynamicProperties[requiredWavePeakPeriodPropertyIndex]; Assert.IsNotNull(wavePeakPeriodProperty); - Assert.IsTrue(wavePeakPeriodProperty.IsReadOnly); - Assert.AreEqual(expectedCategory, wavePeakPeriodProperty.Category); - Assert.AreEqual(expectedWavePeakPeriodDisplayName, wavePeakPeriodProperty.DisplayName); - Assert.AreEqual(expectedWavePeakPeriodDescription, wavePeakPeriodProperty.Description); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(wavePeakPeriodProperty, + "Algemeen", + "Golfperiode (Tp) [s]", + "Berekende golfperiode.", + true); + PropertyDescriptor waveDirectionProperty = dynamicProperties[requiredWaveDirectionPropertyIndex]; + Assert.IsNotNull(waveDirectionProperty); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveDirectionProperty, + "Algemeen", + "Golfrichting t.o.v. Noord [°]", + "Berekende maatgevende golfrichting ten opzichte van het noorden.", + true); PropertyDescriptor waveAngleProperty = dynamicProperties[requiredWaveAnglePropertyIndex]; Assert.IsNotNull(waveAngleProperty); - Assert.IsTrue(waveAngleProperty.IsReadOnly); - Assert.AreEqual(expectedCategory, waveAngleProperty.Category); - Assert.AreEqual(expectedWaveAngleDisplayName, waveAngleProperty.DisplayName); - Assert.AreEqual(expectedWaveAngleDescription, waveAngleProperty.Description); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveAngleProperty, + "Algemeen", + "Golfrichting t.o.v. dijknormaal [°]", + "Berekende maatgevende golfrichting ten opzichte van de dijknormaal.", + true); + + PropertyDescriptor targetProbabilityProperty = dynamicProperties[requiredTargetProbabilityPropertyIndex]; + Assert.IsNotNull(targetProbabilityProperty); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty, + "Algemeen", + "Doelkans [1/jaar]", + "De ingevoerde kans waarvoor het resultaat moet worden berekend.", + true); + + PropertyDescriptor targetReliabilityProperty = dynamicProperties[requiredTargetReliabilityPropertyIndex]; + Assert.IsNotNull(targetReliabilityProperty); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty, + "Algemeen", + "Betrouwbaarheidsindex doelkans [-]", + "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.", + true); + + PropertyDescriptor calculatedProbabilityProperty= dynamicProperties[requiredCalculatedProbabilityPropertyIndex]; + Assert.IsNotNull(calculatedProbabilityProperty); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty, + "Algemeen", + "Berekende kans [1/jaar]", + "De berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[requiredCalculatedReliabilityPropertyIndex]; + Assert.IsNotNull(calculatedReliabilityProperty); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty, + "Algemeen", + "Betrouwbaarheidsindex berekende kans [-]", + "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor calculationConvergenceProperty = dynamicProperties[requiredConvergencePropertyIndex]; + Assert.IsNotNull(calculationConvergenceProperty); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculationConvergenceProperty, + "Algemeen", + "Convergentie", + "Is convergentie bereikt voor de berekening?", + true); } } } \ No newline at end of file Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Ringtoets.Revetment.Forms.Test.csproj =================================================================== diff -u -rd4213a7531c7effcd982ca96e799c2f8231b7627 -r5cb1e84934857c8ac82e41690e7b6fc510d01927 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Ringtoets.Revetment.Forms.Test.csproj (.../Ringtoets.Revetment.Forms.Test.csproj) (revision d4213a7531c7effcd982ca96e799c2f8231b7627) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/Ringtoets.Revetment.Forms.Test.csproj (.../Ringtoets.Revetment.Forms.Test.csproj) (revision 5cb1e84934857c8ac82e41690e7b6fc510d01927) @@ -90,6 +90,10 @@ {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} Core.Common.Utils + + {d749ee4c-ce50-4c17-bf01-9a953028c126} + Core.Common.TestUtil + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data