Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOvertoppingOutputProperties.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOvertoppingOutputProperties.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsOvertoppingOutputProperties.cs (revision 3a7f26cb1570621756ab69b98a965762f6d31374)
@@ -0,0 +1,126 @@
+// Copyright (C) Stichting Deltares 2017. 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 Core.Common.Gui.Attributes;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Utils.Attributes;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Forms.Properties;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses
+{
+ public class GrassCoverErosionInwardsOvertoppingOutputProperties : ObjectProperties
+ {
+ [PropertyOrder(1)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_RequiredProbability_Displayname))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_RequiredProbability_Description))]
+ public string RequiredProbability
+ {
+ get
+ {
+ return ProbabilityFormattingHelper.Format(data.ProbabilityAssessmentOutput.RequiredProbability);
+ }
+ }
+
+ [PropertyOrder(2)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_RequiredReliability_Displayname))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_RequiredReliability_Description))]
+ public RoundedDouble RequiredReliability
+ {
+ get
+ {
+ return data.ProbabilityAssessmentOutput.RequiredReliability;
+ }
+ }
+
+ [PropertyOrder(3)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_Probability_Displayname))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_Probability_Description))]
+ public string Probability
+ {
+ get
+ {
+ return ProbabilityFormattingHelper.Format(data.ProbabilityAssessmentOutput.Probability);
+ }
+ }
+
+ [PropertyOrder(4)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_Reliability_Displayname))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_Reliability_Description))]
+ public RoundedDouble Reliability
+ {
+ get
+ {
+ return data.ProbabilityAssessmentOutput.Reliability;
+ }
+ }
+
+ [PropertyOrder(5)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_FactorOfSafety_Displayname))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ProbabilityAssessmentOutput_FactorOfSafety_Description))]
+ public RoundedDouble FactorOfSafety
+ {
+ get
+ {
+ return data.ProbabilityAssessmentOutput.FactorOfSafety;
+ }
+ }
+
+ [PropertyOrder(6)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.GrassCoverErosionInwardsOutput_WaveHeight_Displayname))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.GrassCoverErosionInwardsOutput_WaveHeight_Description))]
+ public RoundedDouble WaveHeight
+ {
+ get
+ {
+ return data.WaveHeight;
+ }
+ }
+
+ [PropertyOrder(7)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.GrassCoverErosionInwardsOutput_IsOvertoppingDominant_Displayname))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.GrassCoverErosionInwardsOutput_IsOvertoppingDominant_Description))]
+ public bool IsOvertoppingDominant
+ {
+ get
+ {
+ return data.IsOvertoppingDominant;
+ }
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool DynamicVisibleValidationMethod(string propertyName)
+ {
+ return !double.IsNaN(data.WaveHeight);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj
===================================================================
diff -u -r6a474365bc81c87325fbb5ea55bbd4fa60c322a9 -r3a7f26cb1570621756ab69b98a965762f6d31374
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 6a474365bc81c87325fbb5ea55bbd4fa60c322a9)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 3a7f26cb1570621756ab69b98a965762f6d31374)
@@ -67,6 +67,7 @@
+
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOvertoppingOutputPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOvertoppingOutputPropertiesTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsOvertoppingOutputPropertiesTest.cs (revision 3a7f26cb1570621756ab69b98a965762f6d31374)
@@ -0,0 +1,182 @@
+// Copyright (C) Stichting Deltares 2017. 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 Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probability;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsOvertoppingOutputPropertiesTest
+ {
+ private const int requiredProbabilityPropertyIndex = 0;
+ private const int requiredReliabilityPropertyIndex = 1;
+ private const int probabilityPropertyIndex = 2;
+ private const int reliabilityPropertyIndex = 3;
+ private const int factorOfSafetyPropertyIndex = 4;
+ private const int waveHeightIndex = 5;
+ private const int isDominantIndex = 6;
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var properties = new GrassCoverErosionInwardsOvertoppingOutputProperties();
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.IsNull(properties.Data);
+ }
+
+ [Test]
+ public void Data_SetNewInputContextInstance_ReturnCorrectPropertyValues()
+ {
+ // Setup
+ var random = new Random();
+ double waveHeight = random.NextDouble();
+ bool isOvertoppingDominant = Convert.ToBoolean(random.Next(0, 2));
+ double requiredProbability = random.NextDouble();
+ double requiredReliability = random.NextDouble();
+ double probability = random.NextDouble();
+ double reliability = random.NextDouble();
+ double factorOfSafety = random.NextDouble();
+ var probabilityAssessmentOutput = new ProbabilityAssessmentOutput(requiredProbability,
+ requiredReliability,
+ probability,
+ reliability,
+ factorOfSafety);
+
+ var overtoppingOutput = new GrassCoverErosionInwardsOvertoppingOutput(waveHeight,
+ isOvertoppingDominant,
+ probabilityAssessmentOutput);
+
+ // Call
+ var properties = new GrassCoverErosionInwardsOvertoppingOutputProperties
+ {
+ Data = overtoppingOutput
+ };
+
+ // Assert
+ Assert.AreEqual(2, properties.WaveHeight.NumberOfDecimalPlaces);
+ Assert.AreEqual(waveHeight, properties.WaveHeight, properties.WaveHeight.GetAccuracy());
+ Assert.AreEqual(reliability, properties.Reliability, properties.Reliability.GetAccuracy());
+ Assert.AreEqual(requiredReliability, properties.RequiredReliability, properties.RequiredReliability.GetAccuracy());
+ Assert.AreEqual(3, properties.FactorOfSafety.NumberOfDecimalPlaces);
+ Assert.AreEqual(factorOfSafety, properties.FactorOfSafety, properties.FactorOfSafety.GetAccuracy());
+
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(requiredProbability), properties.RequiredProbability);
+ Assert.AreEqual(ProbabilityFormattingHelper.Format(probability), properties.Probability);
+
+ Assert.AreEqual(isOvertoppingDominant, properties.IsOvertoppingDominant);
+ }
+
+ [Test]
+ [TestCase(double.NaN)]
+ [TestCase(10)]
+ public void PropertyAttributes_Always_ReturnExpectedValues(double waveHeight)
+ {
+ // Setup
+ var probabilityAssessmentOutput = new ProbabilityAssessmentOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN);
+ var output = new GrassCoverErosionInwardsOvertoppingOutput(waveHeight,
+ true,
+ probabilityAssessmentOutput);
+
+ // Call
+ var properties = new GrassCoverErosionInwardsOvertoppingOutputProperties
+ {
+ Data = output
+ };
+
+ // Assert
+ int propertiesCount = double.IsNaN(waveHeight) ? 6 : 7;
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(propertiesCount, dynamicProperties.Count);
+
+ bool waveHeightCalculated = !double.IsNaN(waveHeight);
+
+ const string resultCategory = "Resultaat";
+ PropertyDescriptor requiredProbabilityProperty = dynamicProperties[requiredProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(requiredProbabilityProperty,
+ resultCategory,
+ "Faalkanseis [1/jaar]",
+ "De maximaal toegestane faalkanseis voor het toetsspoor.",
+ true);
+
+ PropertyDescriptor requiredReliabilityProperty = dynamicProperties[requiredReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(requiredReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex faalkanseis [-]",
+ "De betrouwbaarheidsindex van de faalkanseis voor het toetsspoor.",
+ true);
+
+ PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty,
+ resultCategory,
+ "Faalkans [1/jaar]",
+ "De kans dat het toetsspoor optreedt voor deze berekening.",
+ true);
+
+ PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex faalkans [-]",
+ "De betrouwbaarheidsindex van de faalkans voor deze berekening.",
+ true);
+
+ PropertyDescriptor factorOfSafetyProperty = dynamicProperties[factorOfSafetyPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(factorOfSafetyProperty,
+ resultCategory,
+ "Veiligheidsfactor [-]",
+ "De veiligheidsfactor voor deze berekening.",
+ true);
+
+ if (waveHeightCalculated)
+ {
+ PropertyDescriptor waveHeightProperty = dynamicProperties[waveHeightIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveHeightProperty,
+ resultCategory,
+ "Indicatieve golfhoogte (Hs) [m]",
+ "De golfhoogte van de overslag deelberekening.",
+ true);
+ }
+
+ int realDominantIndex = waveHeightCalculated
+ ? isDominantIndex
+ : isDominantIndex - 1;
+
+ PropertyDescriptor isDominantProperty = dynamicProperties[realDominantIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isDominantProperty,
+ resultCategory,
+ "Overslag dominant [-]",
+ "Is het resultaat van de overslag deelberekening dominant over de overloop deelberekening.",
+ true);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj
===================================================================
diff -u -r6a474365bc81c87325fbb5ea55bbd4fa60c322a9 -r3a7f26cb1570621756ab69b98a965762f6d31374
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 6a474365bc81c87325fbb5ea55bbd4fa60c322a9)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 3a7f26cb1570621756ab69b98a965762f6d31374)
@@ -76,6 +76,7 @@
+