Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -2258,6 +2258,26 @@
}
///
+ /// Looks up a localized string similar to De categoriegrens voor deze berekening..
+ ///
+ public static string HydraulicBoundaryLocationCalculationOutputProperties_CategoryBoundaryName_Description {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryLocationCalculationOutputProperties_CategoryBoundaryName_Descrip" +
+ "tion", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Categoriegrens.
+ ///
+ public static string HydraulicBoundaryLocationCalculationOutputProperties_CategoryBoundaryName_DisplayName {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryLocationCalculationOutputProperties_CategoryBoundaryName_Display" +
+ "Name", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Hydraulische randvoorwaardenlocatie.
///
public static string HydraulicBoundaryLocationSelectionDialog_Location_Name {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -1449,4 +1449,10 @@
Berekende golfhoogte.
+
+ Categoriegrens
+
+
+ De categoriegrens voor deze berekening.
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationProperties.cs
===================================================================
diff -u -rc78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationProperties.cs (.../DesignWaterLevelCalculationProperties.cs) (revision c78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationProperties.cs (.../DesignWaterLevelCalculationProperties.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -21,16 +21,14 @@
using System;
using Core.Common.Base.Data;
-using Core.Common.Gui.Attributes;
-using Core.Common.Util;
using Core.Common.Util.Attributes;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Forms.Properties;
namespace Ringtoets.Common.Forms.PropertyClasses
{
///
- /// ViewModel of with for properties panel.
+ /// ViewModel of with design water level for properties panel.
///
public class DesignWaterLevelCalculationProperties : HydraulicBoundaryLocationCalculationProperties
{
@@ -44,25 +42,20 @@
[ResourcesDisplayName(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Result_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Result_Description))]
- public override RoundedDouble DesignWaterLevel
+ public override RoundedDouble Result
{
get
{
- return base.DesignWaterLevel;
+ return base.Result;
}
}
- [PropertyOrder(9)]
- [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
- [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_Convergence_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Convergence_Description))]
- public string Convergence
+ public override CalculationConvergence Convergence
{
get
{
- CalculationConvergence convergence = data.Output?.CalculationConvergence ?? CalculationConvergence.NotCalculated;
-
- return new EnumDisplayWrapper(convergence).DisplayName;
+ return base.Convergence;
}
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs
===================================================================
diff -u -rc78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs (.../DesignWaterLevelCalculationsGroupProperties.cs) (revision c78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs (.../DesignWaterLevelCalculationsGroupProperties.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Core.Common.Base;
@@ -37,8 +36,6 @@
///
public class DesignWaterLevelCalculationsGroupProperties : ObjectProperties>
{
- private readonly IEnumerable, string>> calculationCollections;
-
///
/// Creates a new instance of .
///
@@ -51,11 +48,6 @@
throw new ArgumentNullException(nameof(locations));
}
- if (calculationCollections == null)
- {
- throw new ArgumentNullException(nameof(calculationCollections));
- }
-
Data = locations;
}
@@ -70,11 +62,5 @@
return data.Select(location => new HydraulicBoundaryLocationProperties(location)).ToArray();
}
}
-
- private IEnumerable> GetHydraulicBoundaryLocationCalculationsForLocation(HydraulicBoundaryLocation location)
- {
- return calculationCollections.Select(collection => new Tuple(
- collection.Item1.Single(c => ReferenceEquals(c.HydraulicBoundaryLocation, location)), collection.Item2));
- }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationBaseProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationBaseProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationBaseProperties.cs (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -0,0 +1,240 @@
+// 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.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using Core.Common.Base.Data;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Util;
+using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of for properties panel.
+ ///
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public abstract class HydraulicBoundaryLocationCalculationBaseProperties : ObjectProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The hydraulic boundary location calculation.
+ /// Thrown when is null.
+ protected HydraulicBoundaryLocationCalculationBaseProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation)
+ {
+ if (hydraulicBoundaryLocationCalculation == null)
+ {
+ throw new ArgumentNullException(nameof(hydraulicBoundaryLocationCalculation));
+ }
+
+ Data = hydraulicBoundaryLocationCalculation;
+ }
+
+ [PropertyOrder(4)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
+ [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
+ public virtual RoundedDouble Result
+ {
+ get
+ {
+ return data.Output?.Result ?? RoundedDouble.NaN;
+ }
+ }
+
+ [PropertyOrder(5)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_TargetProbability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CalculationOutput_TargetProbability_Description))]
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double TargetProbability
+ {
+ get
+ {
+ return data.Output?.TargetProbability ?? double.NaN;
+ }
+ }
+
+ [PropertyOrder(6)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_TargetReliability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CalculationOutput_TargetReliability_Description))]
+ [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
+ public RoundedDouble TargetReliability
+ {
+ get
+ {
+ return data.Output?.TargetReliability ?? RoundedDouble.NaN;
+ }
+ }
+
+ [PropertyOrder(7)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedProbability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedProbability_Description))]
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double CalculatedProbability
+ {
+ get
+ {
+ return data.Output?.CalculatedProbability ?? double.NaN;
+ }
+ }
+
+ [PropertyOrder(8)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedReliability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedReliability_Description))]
+ [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
+ public RoundedDouble CalculatedReliability
+ {
+ get
+ {
+ return data.Output?.CalculatedReliability ?? RoundedDouble.NaN;
+ }
+ }
+
+ [PropertyOrder(9)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_Convergence_DisplayName))]
+ [TypeConverter(typeof(EnumTypeConverter))]
+ public virtual CalculationConvergence Convergence
+ {
+ get
+ {
+ return data.Output?.CalculationConvergence ?? CalculationConvergence.NotCalculated;
+ }
+ }
+
+ [PropertyOrder(10)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.ShouldIllustrationPointsBeCalculated_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.ShouldIllustrationPointsBeCalculated_Description))]
+ public bool ShouldIllustrationPointsBeCalculated
+ {
+ get
+ {
+ return data.InputParameters.ShouldIllustrationPointsBeCalculated;
+ }
+ set
+ {
+ data.InputParameters.ShouldIllustrationPointsBeCalculated = value;
+ data.NotifyObservers();
+ }
+ }
+
+ [PropertyOrder(11)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_GoverningWindDirection_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_GoverningWindDirection_Description))]
+ public string GoverningWindDirection
+ {
+ get
+ {
+ return GetGeneralResult().GoverningWindDirection.Name;
+ }
+ }
+
+ [PropertyOrder(12)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_AlphaValues_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_AlphaValues_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Alpha))]
+ public Stochast[] AlphaValues
+ {
+ get
+ {
+ return GetGeneralResult().Stochasts.ToArray();
+ }
+ }
+
+ [PropertyOrder(13)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_Durations_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_Durations_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Duration))]
+ public Stochast[] Durations
+ {
+ get
+ {
+ return GetGeneralResult().Stochasts.ToArray();
+ }
+ }
+
+ [PropertyOrder(14)]
+ [DynamicVisible]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPointProperty_IllustrationPoints_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPointProperty_IllustrationPoints_Description))]
+ [TypeConverter(typeof(ExpandableArrayConverter))]
+ public IEnumerable IllustrationPoints
+ {
+ get
+ {
+ IEnumerable topLevelIllustrationPoints =
+ GetGeneralResult().TopLevelIllustrationPoints.ToArray();
+
+ IEnumerable closingSituations = topLevelIllustrationPoints.Select(s => s.ClosingSituation);
+
+ return topLevelIllustrationPoints.Select(p => new TopLevelSubMechanismIllustrationPointProperties(p, closingSituations))
+ .ToArray();
+ }
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool DynamicVisibleValidationMethod(string propertyName)
+ {
+ bool hasGeneralIllustrationPointsResult = GetGeneralResult() != null;
+ if (propertyName == nameof(GoverningWindDirection)
+ || propertyName == nameof(AlphaValues)
+ || propertyName == nameof(Durations)
+ || propertyName == nameof(IllustrationPoints))
+ {
+ return hasGeneralIllustrationPointsResult;
+ }
+
+ return true;
+ }
+
+ private GeneralResult GetGeneralResult()
+ {
+ if (data.HasOutput && data.Output.HasGeneralResult)
+ {
+ return data.Output.GeneralResult;
+ }
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationOutputProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationOutputProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationOutputProperties.cs (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -0,0 +1,86 @@
+// 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 Core.Common.Base.Geometry;
+using Core.Common.Gui.Attributes;
+using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Forms.Properties;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of for properties panel with information
+ /// about the .
+ ///
+ public abstract class HydraulicBoundaryLocationCalculationProperties : HydraulicBoundaryLocationCalculationBaseProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The hydraulic boundary location calculation.
+ /// Thrown when is null.
+ protected HydraulicBoundaryLocationCalculationProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation)
+ : base(hydraulicBoundaryLocationCalculation) {}
+
+ [PropertyOrder(1)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Id_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Id_Description))]
+ public long Id
+ {
+ get
+ {
+ return data.HydraulicBoundaryLocation.Id;
+ }
+ }
+
+ [PropertyOrder(2)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Name_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Name_Description))]
+ public string Name
+ {
+ get
+ {
+ return data.HydraulicBoundaryLocation.Name;
+ }
+ }
+
+ [PropertyOrder(3)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Coordinates_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Coordinates_Description))]
+ public Point2D Location
+ {
+ get
+ {
+ return data.HydraulicBoundaryLocation.Location;
+ }
+ }
+
+ public override string ToString()
+ {
+ return $"{Name} {Location}";
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationProperties.cs
===================================================================
diff -u -r69e65445f53fb8e0c5ca5013d158f597a5c1387c -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationProperties.cs (.../HydraulicBoundaryLocationCalculationProperties.cs) (revision 69e65445f53fb8e0c5ca5013d158f597a5c1387c)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationProperties.cs (.../HydraulicBoundaryLocationCalculationProperties.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -20,239 +20,46 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using Core.Common.Base.Data;
-using Core.Common.Base.Geometry;
using Core.Common.Gui.Attributes;
-using Core.Common.Gui.Converters;
-using Core.Common.Gui.PropertyBag;
using Core.Common.Util.Attributes;
using Ringtoets.Common.Data.Hydraulics;
-using Ringtoets.Common.Data.IllustrationPoints;
-using Ringtoets.Common.Forms.TypeConverters;
-using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+using Ringtoets.Common.Forms.Properties;
namespace Ringtoets.Common.Forms.PropertyClasses
{
///
- /// ViewModel of for properties panel.
+ /// ViewModel of for properties panel with information
+ /// about the calculation output.
///
- [TypeConverter(typeof(ExpandableObjectConverter))]
- public abstract class HydraulicBoundaryLocationCalculationProperties : ObjectProperties
+ public abstract class HydraulicBoundaryLocationCalculationOutputProperties : HydraulicBoundaryLocationCalculationBaseProperties
{
///
- /// Creates a new instance of .
+ /// Creates a new instance of .
///
/// The hydraulic boundary location calculation.
- /// Thrown when is null.
- protected HydraulicBoundaryLocationCalculationProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation)
+ /// The name of the category boundary the calculation belongs to.
+ /// Thrown when any parameter is null.
+ protected HydraulicBoundaryLocationCalculationOutputProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation,
+ string categoryBoundaryName)
+ : base(hydraulicBoundaryLocationCalculation)
{
- if (hydraulicBoundaryLocationCalculation == null)
+ if (categoryBoundaryName == null)
{
- throw new ArgumentNullException(nameof(hydraulicBoundaryLocationCalculation));
+ throw new ArgumentNullException(nameof(categoryBoundaryName));
}
- Data = hydraulicBoundaryLocationCalculation;
+ CategoryBoundaryName = categoryBoundaryName;
}
[PropertyOrder(1)]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Id_Description))]
- public long Id
- {
- get
- {
- return data.HydraulicBoundaryLocation.Id;
- }
- }
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationCalculationOutputProperties_CategoryBoundaryName_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationCalculationOutputProperties_CategoryBoundaryName_Description))]
+ public string CategoryBoundaryName { get; }
- [PropertyOrder(2)]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Name_Description))]
- public string Name
- {
- get
- {
- return data.HydraulicBoundaryLocation.Name;
- }
- }
-
- [PropertyOrder(3)]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Location_Coordinates_Description))]
- public Point2D Location
- {
- get
- {
- return data.HydraulicBoundaryLocation.Location;
- }
- }
-
- [PropertyOrder(5)]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_TargetProbability_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_TargetProbability_Description))]
- [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
- public double TargetProbability
- {
- get
- {
- return data.Output?.TargetProbability ?? double.NaN;
- }
- }
-
- [PropertyOrder(6)]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_TargetReliability_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_TargetReliability_Description))]
- [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
- public RoundedDouble TargetReliability
- {
- get
- {
- return data.Output?.TargetReliability ?? RoundedDouble.NaN;
- }
- }
-
- [PropertyOrder(7)]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedProbability_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedProbability_Description))]
- [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
- public double CalculatedProbability
- {
- get
- {
- return data.Output?.CalculatedProbability ?? double.NaN;
- }
- }
-
- [PropertyOrder(8)]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_Result))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedReliability_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.CalculationOutput_CalculatedReliability_Description))]
- [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
- public RoundedDouble CalculatedReliability
- {
- get
- {
- return data.Output?.CalculatedReliability ?? RoundedDouble.NaN;
- }
- }
-
- [PropertyOrder(10)]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ShouldIllustrationPointsBeCalculated_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ShouldIllustrationPointsBeCalculated_Description))]
- public bool ShouldIllustrationPointsBeCalculated
- {
- get
- {
- return data.InputParameters.ShouldIllustrationPointsBeCalculated;
- }
- set
- {
- data.InputParameters.ShouldIllustrationPointsBeCalculated = value;
- data.NotifyObservers();
- }
- }
-
- [PropertyOrder(11)]
- [DynamicVisible]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_GoverningWindDirection_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_GoverningWindDirection_Description))]
- public string GoverningWindDirection
- {
- get
- {
- return GetGeneralResult().GoverningWindDirection.Name;
- }
- }
-
- [PropertyOrder(12)]
- [DynamicVisible]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_AlphaValues_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_AlphaValues_Description))]
- [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
- [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Alpha))]
- public Stochast[] AlphaValues
- {
- get
- {
- return GetGeneralResult().Stochasts.ToArray();
- }
- }
-
- [PropertyOrder(13)]
- [DynamicVisible]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_Durations_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPoint_Durations_Description))]
- [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
- [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Duration))]
- public Stochast[] Durations
- {
- get
- {
- return GetGeneralResult().Stochasts.ToArray();
- }
- }
-
- [PropertyOrder(14)]
- [DynamicVisible]
- [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_IllustrationPoints))]
- [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPointProperty_IllustrationPoints_DisplayName))]
- [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPointProperty_IllustrationPoints_Description))]
- [TypeConverter(typeof(ExpandableArrayConverter))]
- public IEnumerable IllustrationPoints
- {
- get
- {
- IEnumerable topLevelIllustrationPoints =
- GetGeneralResult().TopLevelIllustrationPoints.ToArray();
-
- IEnumerable closingSituations = topLevelIllustrationPoints.Select(s => s.ClosingSituation);
-
- return topLevelIllustrationPoints.Select(p => new TopLevelSubMechanismIllustrationPointProperties(p, closingSituations))
- .ToArray();
- }
- }
-
- [DynamicVisibleValidationMethod]
- public bool DynamicVisibleValidationMethod(string propertyName)
- {
- bool hasGeneralIllustrationPointsResult = GetGeneralResult() != null;
- if (propertyName == nameof(GoverningWindDirection)
- || propertyName == nameof(AlphaValues)
- || propertyName == nameof(Durations)
- || propertyName == nameof(IllustrationPoints))
- {
- return hasGeneralIllustrationPointsResult;
- }
-
- return true;
- }
-
public override string ToString()
{
- return $"{Name} {Location}";
+ return CategoryBoundaryName;
}
-
- private GeneralResult GetGeneralResult()
- {
- if (data.HasOutput && data.Output.HasGeneralResult)
- {
- return data.Output.GeneralResult;
- }
-
- return null;
- }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs
===================================================================
diff -u -rc78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision c78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -20,12 +20,9 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
using Core.Common.Base.Geometry;
using Core.Common.Gui.Attributes;
-using Core.Common.Gui.Converters;
using Core.Common.Gui.PropertyBag;
using Core.Common.Util.Attributes;
using Ringtoets.Common.Data.Hydraulics;
@@ -39,14 +36,10 @@
[TypeConverter(typeof(ExpandableObjectConverter))]
public class HydraulicBoundaryLocationProperties : ObjectProperties
{
- private readonly IEnumerable> calculations;
-
///
/// Creates a new instance of .
///
/// The location to set as data.
- /// The calculations belonging to the
- /// to show properties for.
/// Thrown when
/// is null.
public HydraulicBoundaryLocationProperties(HydraulicBoundaryLocation location)
@@ -95,19 +88,6 @@
}
}
- [PropertyOrder(4)]
- [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
- [ResourcesDisplayName(typeof(Resources), nameof(Resources.FailureMechanismAssemblyCategories_DisplayName))]
- [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Coordinates_Description))]
- [TypeConverter(typeof(ExpandableArrayConverter))]
- public DesignWaterLevelCalculationProperties[] Calculations
- {
- get
- {
- return calculations.Select(c => new DesignWaterLevelCalculationProperties(c.Item1)).ToArray();
- }
- }
-
public override string ToString()
{
return $"{Name} {Location}";
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationProperties.cs
===================================================================
diff -u -rc78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationProperties.cs (.../WaveHeightCalculationProperties.cs) (revision c78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationProperties.cs (.../WaveHeightCalculationProperties.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -20,19 +20,15 @@
// All rights reserved.
using System;
-using System.ComponentModel;
using Core.Common.Base.Data;
-using Core.Common.Gui.Attributes;
-using Core.Common.Util;
using Core.Common.Util.Attributes;
using Ringtoets.Common.Data.Hydraulics;
-using Ringtoets.Common.Forms.TypeConverters;
using Ringtoets.Common.Forms.Properties;
namespace Ringtoets.Common.Forms.PropertyClasses
{
///
- /// ViewModel of with for properties panel.
+ /// ViewModel of with wave height for properties panel.
///
public class WaveHeightCalculationProperties : HydraulicBoundaryLocationCalculationProperties
{
@@ -44,30 +40,22 @@
public WaveHeightCalculationProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation)
: base(hydraulicBoundaryLocationCalculation) {}
- [PropertyOrder(4)]
- [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
[ResourcesDisplayName(typeof(Resources), nameof(Resources.WaveHeightCalculation_Result_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.WaveHeightCalculation_Result_Description))]
- [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
- public override RoundedDouble DesignWaterLevel
+ public override RoundedDouble Result
{
get
{
- return base.DesignWaterLevel;
+ return base.Result;
}
}
- [PropertyOrder(9)]
- [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_Result))]
- [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_Convergence_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.WaveHeightCalculation_Convergence_Description))]
- public string Convergence
+ public override CalculationConvergence Convergence
{
get
{
- CalculationConvergence convergence = data.Output?.CalculationConvergence ?? CalculationConvergence.NotCalculated;
-
- return new EnumDisplayWrapper(convergence).DisplayName;
+ return base.Convergence;
}
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -102,6 +102,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationPropertiesTest.cs (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -0,0 +1,300 @@
+// 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.Converters;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class DesignWaterLevelCalculationPropertiesTest
+ {
+ private const int idPropertyIndex = 0;
+ private const int namePropertyIndex = 1;
+ private const int coordinatesPropertyIndex = 2;
+ private const int designWaterLevelPropertyIndex = 3;
+ private const int targetProbabilityPropertyIndex = 4;
+ private const int targetReliabilityPropertyIndex = 5;
+ private const int calculatedProbabilityPropertyIndex = 6;
+ private const int calculatedReliabilityPropertyIndex = 7;
+ private const int convergencePropertyIndex = 8;
+ private const int shouldCalculateIllustrationPointsIndex = 9;
+ private const int governingWindDirectionIndex = 10;
+ private const int alphaValuesIndex = 11;
+ private const int durationsIndex = 12;
+ private const int illustrationPointsIndex = 13;
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation());
+
+ // Call
+ var properties = new DesignWaterLevelCalculationProperties(hydraulicBoundaryLocationCalculation);
+
+ // Assert
+ Assert.IsInstanceOf(properties);
+ Assert.AreSame(hydraulicBoundaryLocationCalculation, properties.Data);
+ }
+
+ [Test]
+ public void Constructor_WithoutGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation());
+
+ // Call
+ var properties = new DesignWaterLevelCalculationProperties(hydraulicBoundaryLocationCalculation);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(10, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+ const string resultCategory = "Resultaat";
+ const string illustrationPointsCategory = "Illustratiepunten";
+
+ PropertyDescriptor idProperty = dynamicProperties[idPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(idProperty,
+ generalCategory,
+ "ID",
+ "ID van de hydraulische randvoorwaardenlocatie in de database.",
+ true);
+
+ PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "Naam van de hydraulische randvoorwaardenlocatie.",
+ true);
+
+ PropertyDescriptor coordinatesProperty = dynamicProperties[coordinatesPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(coordinatesProperty,
+ generalCategory,
+ "Coördinaten [m]",
+ "Coördinaten van de hydraulische randvoorwaardenlocatie.",
+ true);
+
+ PropertyDescriptor designWaterLevelProperty = dynamicProperties[designWaterLevelPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(designWaterLevelProperty,
+ resultCategory,
+ "Waterstand [m+NAP]",
+ "Berekende waterstand.",
+ true);
+
+ PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty,
+ resultCategory,
+ "Doelkans [1/jaar]",
+ "De ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor targetReliabilityProperty = dynamicProperties[targetReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex doelkans [-]",
+ "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[calculatedProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty,
+ resultCategory,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[calculatedReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty,
+ resultCategory,
+ "Convergentie",
+ "Is convergentie bereikt in de waterstand berekening?",
+ true);
+
+ PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty,
+ illustrationPointsCategory,
+ "Illustratiepunten inlezen",
+ "Neem de informatie over de illustratiepunten op in het berekeningsresultaat.");
+ }
+
+ [Test]
+ public void Constructor_WithGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = new TestHydraulicBoundaryLocationCalculationOutput(new TestGeneralResultSubMechanismIllustrationPoint())
+ };
+
+ // Call
+ var properties = new DesignWaterLevelCalculationProperties(hydraulicBoundaryLocationCalculation);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(14, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+ const string resultCategory = "Resultaat";
+ const string illustrationPointsCategory = "Illustratiepunten";
+
+ PropertyDescriptor idProperty = dynamicProperties[idPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(idProperty,
+ generalCategory,
+ "ID",
+ "ID van de hydraulische randvoorwaardenlocatie in de database.",
+ true);
+
+ PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "Naam van de hydraulische randvoorwaardenlocatie.",
+ true);
+
+ PropertyDescriptor coordinatesProperty = dynamicProperties[coordinatesPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(coordinatesProperty,
+ generalCategory,
+ "Coördinaten [m]",
+ "Coördinaten van de hydraulische randvoorwaardenlocatie.",
+ true);
+
+ PropertyDescriptor designWaterLevelProperty = dynamicProperties[designWaterLevelPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(designWaterLevelProperty,
+ resultCategory,
+ "Waterstand [m+NAP]",
+ "Berekende waterstand.",
+ true);
+
+ PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty,
+ resultCategory,
+ "Doelkans [1/jaar]",
+ "De ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor targetReliabilityProperty = dynamicProperties[targetReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex doelkans [-]",
+ "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[calculatedProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty,
+ resultCategory,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[calculatedReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty,
+ resultCategory,
+ "Convergentie",
+ "Is convergentie bereikt in de waterstand berekening?",
+ true);
+
+ PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty,
+ illustrationPointsCategory,
+ "Illustratiepunten inlezen",
+ "Neem de informatie over de illustratiepunten op in het berekeningsresultaat.");
+
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[governingWindDirectionIndex],
+ illustrationPointsCategory,
+ "Maatgevende windrichting",
+ "De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is.",
+ true);
+
+ PropertyDescriptor alphaValuesProperty = dynamicProperties[alphaValuesIndex];
+ Assert.NotNull(alphaValuesProperty.Attributes[typeof(KeyValueElementAttribute)]);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty,
+ illustrationPointsCategory,
+ "Invloedscoëfficiënten [-]",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ PropertyDescriptor durationsProperty = dynamicProperties[durationsIndex];
+ Assert.NotNull(durationsProperty.Attributes[typeof(KeyValueElementAttribute)]);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
+ illustrationPointsCategory,
+ "Tijdsduren [uur]",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[illustrationPointsIndex],
+ illustrationPointsCategory,
+ "Illustratiepunten",
+ "De lijst van illustratiepunten voor de berekening.",
+ true);
+ }
+
+ [Test]
+ public void GetProperties_Always_ReturnsExpectedValues()
+ {
+ // Setup
+ var random = new Random();
+ double designWaterLevel = random.NextDouble();
+ var convergence = random.NextEnumValue();
+
+ var hydraulicBoundaryLocationCalculationOutput = new HydraulicBoundaryLocationCalculationOutput(designWaterLevel,
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ convergence,
+ new TestGeneralResultSubMechanismIllustrationPoint());
+
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = hydraulicBoundaryLocationCalculationOutput
+ };
+
+ // Call
+ var properties = new DesignWaterLevelCalculationProperties(hydraulicBoundaryLocationCalculation);
+
+ // Assert
+ Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, properties.Result);
+ Assert.AreEqual(convergence, properties.Convergence);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsPropertiesTest.cs (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -0,0 +1,93 @@
+// 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.ComponentModel;
+using Core.Common.Base;
+using Core.Common.Gui.Converters;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class DesignWaterLevelCalculationsPropertiesTest
+ {
+ private const int requiredLocationsPropertyIndex = 0;
+
+ [Test]
+ public void Constructor_WithHydraulicBoundaryLocationCalculations_ExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculations = new ObservableList();
+
+ // Call
+ var properties = new DesignWaterLevelCalculationsProperties(hydraulicBoundaryLocationCalculations);
+
+ // Assert
+ Assert.IsInstanceOf(properties);
+ Assert.AreSame(hydraulicBoundaryLocationCalculations, properties.Data);
+
+ TestHelper.AssertTypeConverter(
+ nameof(DesignWaterLevelCalculationsProperties.Calculations));
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
+ {
+ // Call
+ var properties = new DesignWaterLevelCalculationsProperties(new ObservableList());
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(1, dynamicProperties.Count);
+
+ PropertyDescriptor locationsProperty = dynamicProperties[requiredLocationsPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(locationsProperty,
+ "Algemeen",
+ "Locaties",
+ "Locaties uit de hydraulische randvoorwaardendatabase.",
+ true);
+ }
+
+ [Test]
+ public void GetProperties_WithData_ReturnExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = new TestHydraulicBoundaryLocationCalculationOutput(1.5)
+ };
+
+ // Call
+ var properties = new DesignWaterLevelCalculationsProperties(new ObservableList
+ {
+ hydraulicBoundaryLocationCalculation
+ });
+
+ // Assert
+ Assert.AreEqual(1, properties.Calculations.Length);
+ Assert.AreSame(hydraulicBoundaryLocationCalculation, properties.Calculations[0].Data);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationBasePropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationBasePropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationBasePropertiesTest.cs (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -0,0 +1,358 @@
+// 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 System.Linq;
+using Core.Common.Base;
+using Core.Common.Gui.Converters;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PropertyClasses;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class HydraulicBoundaryLocationCalculationBasePropertiesTest
+ {
+ private const int resultPropertyIndex = 0;
+ private const int targetProbabilityPropertyIndex = 1;
+ private const int targetReliabilityPropertyIndex = 2;
+ private const int calculatedProbabilityPropertyIndex = 3;
+ private const int calculatedReliabilityPropertyIndex = 4;
+ private const int convergencePropertyIndex = 5;
+ private const int shouldCalculateIllustrationPointsIndex = 6;
+ private const int governingWindDirectionIndex = 7;
+ private const int alphaValuesIndex = 8;
+ private const int durationsIndex = 9;
+ private const int illustrationPointsIndex = 10;
+
+ [Test]
+ public void Constructor_HydraulicBoundaryLocationCalculationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new TestHydraulicBoundaryLocationCalculationBaseProperties(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("hydraulicBoundaryLocationCalculation", paramName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedProperties()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation());
+
+ // Call
+ var properties = new TestHydraulicBoundaryLocationCalculationBaseProperties(hydraulicBoundaryLocationCalculation);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.IsInstanceOf(TypeDescriptor.GetConverter(properties, true));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.Result));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.TargetProbability));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.TargetReliability));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.CalculatedProbability));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.CalculatedReliability));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.Convergence));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.AlphaValues));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.Durations));
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationCalculationProperties.IllustrationPoints));
+ }
+
+ [Test]
+ public void Constructor_WithoutGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation());
+
+ // Call
+ var properties = new TestHydraulicBoundaryLocationCalculationBaseProperties(hydraulicBoundaryLocationCalculation);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(7, dynamicProperties.Count);
+
+ const string resultCategory = "Resultaat";
+ const string illustrationPointsCategory = "Illustratiepunten";
+
+ PropertyDescriptor resultProperty = dynamicProperties[resultPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultProperty,
+ resultCategory,
+ nameof(properties.Result),
+ "",
+ true);
+
+ PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty,
+ resultCategory,
+ "Doelkans [1/jaar]",
+ "De ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor targetReliabilityProperty = dynamicProperties[targetReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex doelkans [-]",
+ "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[calculatedProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty,
+ resultCategory,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[calculatedReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty,
+ resultCategory,
+ "Convergentie",
+ string.Empty,
+ true);
+
+ PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty,
+ illustrationPointsCategory,
+ "Illustratiepunten inlezen",
+ "Neem de informatie over de illustratiepunten op in het berekeningsresultaat.");
+ }
+
+ [Test]
+ public void Constructor_WithGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = new TestHydraulicBoundaryLocationCalculationOutput(new TestGeneralResultSubMechanismIllustrationPoint())
+ };
+
+ // Call
+ var properties = new TestHydraulicBoundaryLocationCalculationBaseProperties(hydraulicBoundaryLocationCalculation);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(11, dynamicProperties.Count);
+
+ const string resultCategory = "Resultaat";
+ const string illustrationPointsCategory = "Illustratiepunten";
+
+ PropertyDescriptor resultProperty = dynamicProperties[resultPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultProperty,
+ resultCategory,
+ nameof(properties.Result),
+ "",
+ true);
+
+ PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty,
+ resultCategory,
+ "Doelkans [1/jaar]",
+ "De ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor targetReliabilityProperty = dynamicProperties[targetReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex doelkans [-]",
+ "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[calculatedProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty,
+ resultCategory,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[calculatedReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty,
+ resultCategory,
+ "Convergentie",
+ string.Empty,
+ true);
+
+ PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty,
+ illustrationPointsCategory,
+ "Illustratiepunten inlezen",
+ "Neem de informatie over de illustratiepunten op in het berekeningsresultaat.");
+
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[governingWindDirectionIndex],
+ illustrationPointsCategory,
+ "Maatgevende windrichting",
+ "De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is.",
+ true);
+
+ PropertyDescriptor alphaValuesProperty = dynamicProperties[alphaValuesIndex];
+ Assert.NotNull(alphaValuesProperty.Attributes[typeof(KeyValueElementAttribute)]);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty,
+ illustrationPointsCategory,
+ "Invloedscoëfficiënten [-]",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ PropertyDescriptor durationsProperty = dynamicProperties[durationsIndex];
+ Assert.NotNull(durationsProperty.Attributes[typeof(KeyValueElementAttribute)]);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
+ illustrationPointsCategory,
+ "Tijdsduren [uur]",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[illustrationPointsIndex],
+ illustrationPointsCategory,
+ "Illustratiepunten",
+ "De lijst van illustratiepunten voor de berekening.",
+ true);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void GetProperties_ValidData_ReturnsExpectedValues(bool withIllustrationPoints)
+ {
+ // Setup
+ var random = new Random();
+
+ double targetProbability = random.NextDouble();
+ double targetReliability = random.NextDouble();
+ double calculatedProbability = random.NextDouble();
+ double calculatedReliability = random.NextDouble();
+ double result = random.NextDouble();
+ var convergence = random.NextEnumValue();
+
+ var illustrationPoints = new[]
+ {
+ new TopLevelSubMechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubMechanismIllustrationPoint())
+ };
+ var stochasts = new[]
+ {
+ new Stochast("a", 2, 3)
+ };
+ const string governingWindDirection = "EAST";
+ GeneralResult generalResult =
+ withIllustrationPoints
+ ? new GeneralResult(new WindDirection(governingWindDirection, 2),
+ stochasts,
+ illustrationPoints)
+ : null;
+
+ var hydraulicBoundaryLocationCalculationOutput = new HydraulicBoundaryLocationCalculationOutput(result,
+ targetProbability,
+ targetReliability,
+ calculatedProbability,
+ calculatedReliability,
+ convergence,
+ generalResult);
+
+ // Call
+ var properties = new TestHydraulicBoundaryLocationCalculationBaseProperties(
+ new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = hydraulicBoundaryLocationCalculationOutput
+ });
+
+ // Assert
+ Assert.AreEqual(targetProbability, properties.TargetProbability);
+ Assert.AreEqual(targetReliability, properties.TargetReliability, properties.TargetReliability.GetAccuracy());
+ Assert.AreEqual(calculatedProbability, properties.CalculatedProbability);
+ Assert.AreEqual(calculatedReliability, properties.CalculatedReliability, properties.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual(convergence, properties.Convergence);
+
+ if (withIllustrationPoints)
+ {
+ GeneralResult expectedGeneralResult = hydraulicBoundaryLocationCalculationOutput.GeneralResult;
+ CollectionAssert.AreEqual(expectedGeneralResult.Stochasts, properties.AlphaValues);
+ CollectionAssert.AreEqual(expectedGeneralResult.Stochasts, properties.Durations);
+ CollectionAssert.AreEqual(expectedGeneralResult.TopLevelIllustrationPoints, properties.IllustrationPoints.Select(ip => ip.Data));
+ Assert.AreEqual(expectedGeneralResult.GoverningWindDirection.Name, properties.GoverningWindDirection);
+ }
+ }
+
+ [Test]
+ public void ShouldIllustrationPointsBeCalculated_SetNewValue_NotifyObservers()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ InputParameters =
+ {
+ ShouldIllustrationPointsBeCalculated = false
+ }
+ };
+
+ hydraulicBoundaryLocationCalculation.Attach(observer);
+
+ var properties = new TestHydraulicBoundaryLocationCalculationBaseProperties(hydraulicBoundaryLocationCalculation);
+
+ // Call
+ properties.ShouldIllustrationPointsBeCalculated = true;
+
+ // Assert
+ Assert.IsTrue(hydraulicBoundaryLocationCalculation.InputParameters.ShouldIllustrationPointsBeCalculated);
+ mocks.VerifyAll();
+ }
+
+ private class TestHydraulicBoundaryLocationCalculationBaseProperties : HydraulicBoundaryLocationCalculationBaseProperties
+ {
+ public TestHydraulicBoundaryLocationCalculationBaseProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation)
+ : base(hydraulicBoundaryLocationCalculation) {}
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationOutputPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationOutputPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationOutputPropertiesTest.cs (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -0,0 +1,314 @@
+// 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.Converters;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class HydraulicBoundaryLocationCalculationOutputPropertiesTest
+ {
+ private const int categoryBoundaryNamePropertyIndex = 0;
+ private const int resultPropertyIndex = 1;
+ private const int targetProbabilityPropertyIndex = 2;
+ private const int targetReliabilityPropertyIndex = 3;
+ private const int calculatedProbabilityPropertyIndex = 4;
+ private const int calculatedReliabilityPropertyIndex = 5;
+ private const int convergencePropertyIndex = 6;
+ private const int shouldCalculateIllustrationPointsIndex = 7;
+ private const int governingWindDirectionIndex = 8;
+ private const int alphaValuesIndex = 9;
+ private const int durationsIndex = 10;
+ private const int illustrationPointsIndex = 11;
+
+ [Test]
+ public void Constructor_HydraulicBoundaryLocationCalculationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new TestHydraulicBoundaryLocationCalculationOutputProperties(null, "A");
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("hydraulicBoundaryLocationCalculation", paramName);
+ }
+
+ [Test]
+ public void Constructor_CategoryBoundaryNameNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new TestHydraulicBoundaryLocationCalculationOutputProperties(
+ new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()),
+ null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("categoryBoundaryName", paramName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedProperties()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation());
+
+ // Call
+ var properties = new TestHydraulicBoundaryLocationCalculationOutputProperties(hydraulicBoundaryLocationCalculation, "A");
+
+ // Assert
+ Assert.IsInstanceOf(properties);
+ }
+
+ [Test]
+ public void Constructor_WithoutGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation());
+
+ // Call
+ var properties = new TestHydraulicBoundaryLocationCalculationOutputProperties(hydraulicBoundaryLocationCalculation, "A");
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(8, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+ const string resultCategory = "Resultaat";
+ const string illustrationPointsCategory = "Illustratiepunten";
+
+ PropertyDescriptor categoryBoundaryNameProperty = dynamicProperties[categoryBoundaryNamePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoryBoundaryNameProperty,
+ generalCategory,
+ "Categoriegrens",
+ "De categoriegrens voor deze berekening.",
+ true);
+
+ PropertyDescriptor resultProperty = dynamicProperties[resultPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultProperty,
+ resultCategory,
+ nameof(properties.Result),
+ "",
+ true);
+
+ PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty,
+ resultCategory,
+ "Doelkans [1/jaar]",
+ "De ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor targetReliabilityProperty = dynamicProperties[targetReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex doelkans [-]",
+ "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[calculatedProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty,
+ resultCategory,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[calculatedReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty,
+ resultCategory,
+ "Convergentie",
+ string.Empty,
+ true);
+
+ PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty,
+ illustrationPointsCategory,
+ "Illustratiepunten inlezen",
+ "Neem de informatie over de illustratiepunten op in het berekeningsresultaat.");
+ }
+
+ [Test]
+ public void Constructor_WithGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = new TestHydraulicBoundaryLocationCalculationOutput(new TestGeneralResultSubMechanismIllustrationPoint())
+ };
+
+ // Call
+ var properties = new TestHydraulicBoundaryLocationCalculationOutputProperties(hydraulicBoundaryLocationCalculation, "A");
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(12, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+ const string resultCategory = "Resultaat";
+ const string illustrationPointsCategory = "Illustratiepunten";
+
+ PropertyDescriptor categoryBoundaryNameProperty = dynamicProperties[categoryBoundaryNamePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoryBoundaryNameProperty,
+ generalCategory,
+ "Categoriegrens",
+ "De categoriegrens voor deze berekening.",
+ true);
+
+ PropertyDescriptor resultProperty = dynamicProperties[resultPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultProperty,
+ resultCategory,
+ nameof(properties.Result),
+ "",
+ true);
+
+ PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty,
+ resultCategory,
+ "Doelkans [1/jaar]",
+ "De ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor targetReliabilityProperty = dynamicProperties[targetReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex doelkans [-]",
+ "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.",
+ true);
+
+ PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[calculatedProbabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty,
+ resultCategory,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[calculatedReliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty,
+ resultCategory,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty,
+ resultCategory,
+ "Convergentie",
+ string.Empty,
+ true);
+
+ PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty,
+ illustrationPointsCategory,
+ "Illustratiepunten inlezen",
+ "Neem de informatie over de illustratiepunten op in het berekeningsresultaat.");
+
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[governingWindDirectionIndex],
+ illustrationPointsCategory,
+ "Maatgevende windrichting",
+ "De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is.",
+ true);
+
+ PropertyDescriptor alphaValuesProperty = dynamicProperties[alphaValuesIndex];
+ Assert.NotNull(alphaValuesProperty.Attributes[typeof(KeyValueElementAttribute)]);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty,
+ illustrationPointsCategory,
+ "Invloedscoëfficiënten [-]",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ PropertyDescriptor durationsProperty = dynamicProperties[durationsIndex];
+ Assert.NotNull(durationsProperty.Attributes[typeof(KeyValueElementAttribute)]);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
+ illustrationPointsCategory,
+ "Tijdsduren [uur]",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[illustrationPointsIndex],
+ illustrationPointsCategory,
+ "Illustratiepunten",
+ "De lijst van illustratiepunten voor de berekening.",
+ true);
+ }
+
+ [Test]
+ public void GetProperties_ValidData_ReturnsExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ const string categoryBoundaryName = "A-Z";
+ var calculationConvergence = random.NextEnumValue();
+
+ var hydraulicBoundaryLocationCalculationOutput = new HydraulicBoundaryLocationCalculationOutput(random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ calculationConvergence,
+ null);
+
+ // Call
+ var properties = new TestHydraulicBoundaryLocationCalculationOutputProperties(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = hydraulicBoundaryLocationCalculationOutput
+ },
+ categoryBoundaryName);
+
+ // Assert
+ Assert.AreEqual(categoryBoundaryName, properties.CategoryBoundaryName);
+ Assert.AreEqual(calculationConvergence, properties.Convergence);
+ }
+
+ [Test]
+ public void ToString_Always_ReturnsNameAndLocation()
+ {
+ // Setup
+ const string categoryBoundaryName = "C";
+
+ // Call
+ HydraulicBoundaryLocationCalculationOutputProperties properties = new TestHydraulicBoundaryLocationCalculationOutputProperties(
+ new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()),
+ categoryBoundaryName);
+
+ // Assert
+ Assert.AreEqual(categoryBoundaryName, properties.ToString());
+ }
+
+ private class TestHydraulicBoundaryLocationCalculationOutputProperties : HydraulicBoundaryLocationCalculationOutputProperties
+ {
+ public TestHydraulicBoundaryLocationCalculationOutputProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation,
+ string categoryBoundaryName)
+ : base(hydraulicBoundaryLocationCalculation, categoryBoundaryName) {}
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationPropertiesTest.cs
===================================================================
diff -u -r8eb9358f28dc1eaedd25a81117b02096e12f8d65 -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationPropertiesTest.cs (.../HydraulicBoundaryLocationCalculationPropertiesTest.cs) (revision 8eb9358f28dc1eaedd25a81117b02096e12f8d65)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationPropertiesTest.cs (.../HydraulicBoundaryLocationCalculationPropertiesTest.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -21,20 +21,14 @@
using System;
using System.ComponentModel;
-using System.Linq;
-using Core.Common.Base;
using Core.Common.Base.Geometry;
using Core.Common.Gui.Converters;
-using Core.Common.Gui.PropertyBag;
using Core.Common.TestUtil;
using NUnit.Framework;
-using Rhino.Mocks;
using Ringtoets.Common.Data.Hydraulics;
-using Ringtoets.Common.Data.IllustrationPoints;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
using Ringtoets.Common.Forms.PropertyClasses;
-using Ringtoets.Common.Forms.TypeConverters;
namespace Ringtoets.Common.Forms.Test.PropertyClasses
{
@@ -44,15 +38,17 @@
private const int idPropertyIndex = 0;
private const int namePropertyIndex = 1;
private const int coordinatesPropertyIndex = 2;
- private const int targetProbabilityPropertyIndex = 3;
- private const int targetReliabilityPropertyIndex = 4;
- private const int calculatedProbabilityPropertyIndex = 5;
- private const int calculatedReliabilityPropertyIndex = 6;
- private const int shouldCalculateIllustrationPointsIndex = 7;
- private const int governingWindDirectionIndex = 8;
- private const int alphaValuesIndex = 9;
- private const int durationsIndex = 10;
- private const int illustrationPointsIndex = 11;
+ private const int resultPropertyIndex = 3;
+ private const int targetProbabilityPropertyIndex = 4;
+ private const int targetReliabilityPropertyIndex = 5;
+ private const int calculatedProbabilityPropertyIndex = 6;
+ private const int calculatedReliabilityPropertyIndex = 7;
+ private const int convergencePropertyIndex = 8;
+ private const int shouldCalculateIllustrationPointsIndex = 9;
+ private const int governingWindDirectionIndex = 10;
+ private const int alphaValuesIndex = 11;
+ private const int durationsIndex = 12;
+ private const int illustrationPointsIndex = 13;
[Test]
public void Constructor_HydraulicBoundaryLocationCalculationNull_ThrowsArgumentNullException()
@@ -75,22 +71,7 @@
var properties = new TestHydraulicBoundaryLocationCalculationProperties(hydraulicBoundaryLocationCalculation);
// Assert
- Assert.IsInstanceOf>(properties);
- Assert.IsInstanceOf(TypeDescriptor.GetConverter(properties, true));
- TestHelper.AssertTypeConverter(
- nameof(HydraulicBoundaryLocationCalculationProperties.TargetProbability));
- TestHelper.AssertTypeConverter(
- nameof(HydraulicBoundaryLocationCalculationProperties.TargetReliability));
- TestHelper.AssertTypeConverter(
- nameof(HydraulicBoundaryLocationCalculationProperties.CalculatedProbability));
- TestHelper.AssertTypeConverter(
- nameof(HydraulicBoundaryLocationCalculationProperties.CalculatedReliability));
- TestHelper.AssertTypeConverter(
- nameof(HydraulicBoundaryLocationCalculationProperties.AlphaValues));
- TestHelper.AssertTypeConverter(
- nameof(HydraulicBoundaryLocationCalculationProperties.Durations));
- TestHelper.AssertTypeConverter(
- nameof(HydraulicBoundaryLocationCalculationProperties.IllustrationPoints));
+ Assert.IsInstanceOf(properties);
}
[Test]
@@ -104,7 +85,7 @@
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
- Assert.AreEqual(8, dynamicProperties.Count);
+ Assert.AreEqual(10, dynamicProperties.Count);
const string generalCategory = "Algemeen";
const string resultCategory = "Resultaat";
@@ -131,6 +112,13 @@
"Coördinaten van de hydraulische randvoorwaardenlocatie.",
true);
+ PropertyDescriptor resultProperty = dynamicProperties[resultPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultProperty,
+ resultCategory,
+ nameof(properties.Result),
+ "",
+ true);
+
PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty,
resultCategory,
@@ -159,6 +147,13 @@
"Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
true);
+ PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty,
+ resultCategory,
+ "Convergentie",
+ string.Empty,
+ true);
+
PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty,
illustrationPointsCategory,
@@ -180,7 +175,7 @@
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
- Assert.AreEqual(12, dynamicProperties.Count);
+ Assert.AreEqual(14, dynamicProperties.Count);
const string generalCategory = "Algemeen";
const string resultCategory = "Resultaat";
@@ -207,6 +202,13 @@
"Coördinaten van de hydraulische randvoorwaardenlocatie.",
true);
+ PropertyDescriptor resultProperty = dynamicProperties[resultPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultProperty,
+ resultCategory,
+ nameof(properties.Result),
+ "",
+ true);
+
PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty,
resultCategory,
@@ -235,6 +237,13 @@
"Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
true);
+ PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty,
+ resultCategory,
+ "Convergentie",
+ string.Empty,
+ true);
+
PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty,
illustrationPointsCategory,
@@ -271,48 +280,24 @@
}
[Test]
- [TestCase(true)]
- [TestCase(false)]
- public void GetProperties_ValidData_ReturnsExpectedValues(bool withIllustrationPoints)
+ public void GetProperties_ValidData_ReturnsExpectedValues()
{
// Setup
- var random = new Random();
+ var random = new Random(39);
const long id = 1234L;
const double x = 567.0;
const double y = 890.0;
const string name = "";
+ var calculationConvergence = random.NextEnumValue();
- double targetProbability = random.NextDouble();
- double targetReliability = random.NextDouble();
- double calculatedProbability = random.NextDouble();
- double calculatedReliability = random.NextDouble();
- double result = random.NextDouble();
- var convergence = random.NextEnumValue();
+ var hydraulicBoundaryLocationCalculationOutput = new HydraulicBoundaryLocationCalculationOutput(random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ calculationConvergence,
+ null);
- var illustrationPoints = new[]
- {
- new TopLevelSubMechanismIllustrationPoint(new WindDirection("WEST", 4), "sluit", new TestSubMechanismIllustrationPoint())
- };
- var stochasts = new[]
- {
- new Stochast("a", 2, 3)
- };
- const string governingWindDirection = "EAST";
- GeneralResult generalResult =
- withIllustrationPoints
- ? new GeneralResult(new WindDirection(governingWindDirection, 2),
- stochasts,
- illustrationPoints)
- : null;
-
- var hydraulicBoundaryLocationCalculationOutput = new HydraulicBoundaryLocationCalculationOutput(result,
- targetProbability,
- targetReliability,
- calculatedProbability,
- calculatedReliability,
- convergence,
- generalResult);
-
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y);
var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation)
{
@@ -327,20 +312,7 @@
Assert.AreEqual(name, properties.Name);
var coordinates = new Point2D(x, y);
Assert.AreEqual(coordinates, properties.Location);
-
- Assert.AreEqual(targetProbability, properties.TargetProbability);
- Assert.AreEqual(targetReliability, properties.TargetReliability, properties.TargetReliability.GetAccuracy());
- Assert.AreEqual(calculatedProbability, properties.CalculatedProbability);
- Assert.AreEqual(calculatedReliability, properties.CalculatedReliability, properties.CalculatedReliability.GetAccuracy());
-
- if (withIllustrationPoints)
- {
- GeneralResult expectedGeneralResult = hydraulicBoundaryLocationCalculationOutput.GeneralResult;
- CollectionAssert.AreEqual(expectedGeneralResult.Stochasts, properties.AlphaValues);
- CollectionAssert.AreEqual(expectedGeneralResult.Stochasts, properties.Durations);
- CollectionAssert.AreEqual(expectedGeneralResult.TopLevelIllustrationPoints, properties.IllustrationPoints.Select(ip => ip.Data));
- Assert.AreEqual(expectedGeneralResult.GoverningWindDirection.Name, properties.GoverningWindDirection);
- }
+ Assert.AreEqual(calculationConvergence, properties.Convergence);
}
[Test]
@@ -362,35 +334,6 @@
Assert.AreEqual(expectedString, properties.ToString());
}
- [Test]
- public void ShouldIllustrationPointsBeCalculated_SetNewValue_NotifyObservers()
- {
- // Setup
- var mocks = new MockRepository();
- var observer = mocks.StrictMock();
- observer.Expect(o => o.UpdateObserver());
- mocks.ReplayAll();
-
- var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
- {
- InputParameters =
- {
- ShouldIllustrationPointsBeCalculated = false
- }
- };
-
- hydraulicBoundaryLocationCalculation.Attach(observer);
-
- var properties = new TestHydraulicBoundaryLocationCalculationProperties(hydraulicBoundaryLocationCalculation);
-
- // Call
- properties.ShouldIllustrationPointsBeCalculated = true;
-
- // Assert
- Assert.IsTrue(hydraulicBoundaryLocationCalculation.InputParameters.ShouldIllustrationPointsBeCalculated);
- mocks.VerifyAll();
- }
-
private class TestHydraulicBoundaryLocationCalculationProperties : HydraulicBoundaryLocationCalculationProperties
{
public TestHydraulicBoundaryLocationCalculationProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation)
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationPropertiesTest.cs
===================================================================
diff -u -rc78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationPropertiesTest.cs (.../WaveHeightCalculationPropertiesTest.cs) (revision c78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationPropertiesTest.cs (.../WaveHeightCalculationPropertiesTest.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -23,7 +23,6 @@
using System.ComponentModel;
using Core.Common.Gui.Converters;
using Core.Common.TestUtil;
-using Core.Common.Util;
using NUnit.Framework;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.TestUtil;
@@ -294,10 +293,8 @@
var properties = new WaveHeightCalculationProperties(hydraulicBoundaryLocationCalculation);
// Assert
- Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, properties.DesignWaterLevel);
-
- string convergenceValue = new EnumDisplayWrapper(convergence).DisplayName;
- Assert.AreEqual(convergenceValue, properties.Convergence);
+ Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, properties.Result);
+ Assert.AreEqual(convergence, properties.Convergence);
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationsPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationsPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationsPropertiesTest.cs (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -0,0 +1,93 @@
+// 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.ComponentModel;
+using Core.Common.Base;
+using Core.Common.Gui.Converters;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class WaveHeightCalculationsPropertiesTest
+ {
+ private const int requiredLocationsPropertyIndex = 0;
+
+ [Test]
+ public void Constructor_WithHydraulicBoundaryLocationCalculations_ExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculations = new ObservableList();
+
+ // Call
+ var properties = new WaveHeightCalculationsProperties(hydraulicBoundaryLocationCalculations);
+
+ // Assert
+ Assert.IsInstanceOf(properties);
+ Assert.AreSame(hydraulicBoundaryLocationCalculations, properties.Data);
+
+ TestHelper.AssertTypeConverter(
+ nameof(WaveHeightCalculationsProperties.Calculations));
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
+ {
+ // Call
+ var properties = new WaveHeightCalculationsProperties(new ObservableList());
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(1, dynamicProperties.Count);
+
+ PropertyDescriptor locationsProperty = dynamicProperties[requiredLocationsPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(locationsProperty,
+ "Algemeen",
+ "Locaties",
+ "Locaties uit de hydraulische randvoorwaardendatabase.",
+ true);
+ }
+
+ [Test]
+ public void GetProperties_WithData_ReturnExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = new TestHydraulicBoundaryLocationCalculationOutput(1.5)
+ };
+
+ // Call
+ var properties = new WaveHeightCalculationsProperties(new ObservableList
+ {
+ hydraulicBoundaryLocationCalculation
+ });
+
+ // Assert
+ Assert.AreEqual(1, properties.Calculations.Length);
+ Assert.AreSame(hydraulicBoundaryLocationCalculation, properties.Calculations[0].Data);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -96,11 +96,15 @@
+
+
+
+
@@ -128,6 +132,7 @@
+
Fisheye: Tag 04ffe9435f3031323b2eeac4718e85dfd6022dbe refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelCalculationPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 04ffe9435f3031323b2eeac4718e85dfd6022dbe refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 04ffe9435f3031323b2eeac4718e85dfd6022dbe refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightCalculationsPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57 -r04ffe9435f3031323b2eeac4718e85dfd6022dbe
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 1eb7e7ef92a8a08a227ce81e75a2ac95df4b3b57)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
@@ -57,13 +57,10 @@
-
-
-