Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r04ffe9435f3031323b2eeac4718e85dfd6022dbe -rdd3fbc29b15246ce6d2496e685398011e85bd21d
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -2278,6 +2278,15 @@
}
///
+ /// Looks up a localized string similar to De berekeningen per categoriegrens voor deze locatie..
+ ///
+ public static string HydraulicBoundaryLocationProperties_CategoryBoundaries_Description {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryLocationProperties_CategoryBoundaries_Description", 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 -r04ffe9435f3031323b2eeac4718e85dfd6022dbe -rdd3fbc29b15246ce6d2496e685398011e85bd21d
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -1455,4 +1455,7 @@
De categoriegrens voor deze berekening.
+
+ De berekeningen per categoriegrens voor deze locatie.
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationOutputProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationOutputProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationOutputProperties.cs (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -0,0 +1,65 @@
+// 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.Data;
+using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Forms.Properties;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of with design water level for properties panel
+ /// showing only output.
+ ///
+ public class DesignWaterLevelCalculationOutputProperties : HydraulicBoundaryLocationCalculationOutputProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The hydraulic boundary location calculation.
+ /// The name of the category boundary this calculation belongs to.
+ /// Thrown when is null.
+ public DesignWaterLevelCalculationOutputProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation,
+ string categoryBoundaryName)
+ : base(hydraulicBoundaryLocationCalculation, categoryBoundaryName) {}
+
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Result_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Result_Description))]
+ public override RoundedDouble Result
+ {
+ get
+ {
+ return base.Result;
+ }
+ }
+
+ [ResourcesDescription(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Convergence_Description))]
+ public override CalculationConvergence Convergence
+ {
+ get
+ {
+ return base.Convergence;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs
===================================================================
diff -u -r04ffe9435f3031323b2eeac4718e85dfd6022dbe -rdd3fbc29b15246ce6d2496e685398011e85bd21d
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs (.../DesignWaterLevelCalculationsGroupProperties.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs (.../DesignWaterLevelCalculationsGroupProperties.cs) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -20,9 +20,9 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
-using Core.Common.Base;
using Core.Common.Gui.Converters;
using Core.Common.Gui.PropertyBag;
using Core.Common.Util.Attributes;
@@ -34,20 +34,32 @@
///
/// ViewModel of an enumeration of for properties panel.
///
- public class DesignWaterLevelCalculationsGroupProperties : ObjectProperties>
+ public class DesignWaterLevelCalculationsGroupProperties : ObjectProperties>
{
+ private readonly IEnumerable>> calculationsPerCategoryBoundary;
+
///
/// Creates a new instance of .
///
/// The locations to set as data.
+ /// A collection of tuples containing the category boundary name and
+ /// its corresponding collection of .
/// Thrown when any parameter is null.
- public DesignWaterLevelCalculationsGroupProperties(ObservableList locations)
+ public DesignWaterLevelCalculationsGroupProperties(IEnumerable locations,
+ IEnumerable>> calculationsPerCategoryBoundary)
{
if (locations == null)
{
throw new ArgumentNullException(nameof(locations));
}
+ if (calculationsPerCategoryBoundary == null)
+ {
+ throw new ArgumentNullException(nameof(calculationsPerCategoryBoundary));
+ }
+
+ this.calculationsPerCategoryBoundary = calculationsPerCategoryBoundary;
+
Data = locations;
}
@@ -59,8 +71,16 @@
{
get
{
- return data.Select(location => new HydraulicBoundaryLocationProperties(location)).ToArray();
+ return data.Select(location => new HydraulicBoundaryLocationProperties(location, GetHydraulicBoundaryLocationCalculationsForLocation(location))).ToArray();
}
}
+
+ private IEnumerable> GetHydraulicBoundaryLocationCalculationsForLocation(HydraulicBoundaryLocation location)
+ {
+ return calculationsPerCategoryBoundary.Select(boundaryCalculations =>
+ new Tuple(
+ boundaryCalculations.Item1,
+ boundaryCalculations.Item2.Single(calculation => ReferenceEquals(calculation.HydraulicBoundaryLocation, location))));
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs
===================================================================
diff -u -r04ffe9435f3031323b2eeac4718e85dfd6022dbe -rdd3fbc29b15246ce6d2496e685398011e85bd21d
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs (.../HydraulicBoundaryLocationProperties.cs) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -20,9 +20,12 @@
// 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;
@@ -36,20 +39,31 @@
[TypeConverter(typeof(ExpandableObjectConverter))]
public class HydraulicBoundaryLocationProperties : ObjectProperties
{
+ private readonly IEnumerable> calculationPerCategoryBoundary;
+
///
/// Creates a new instance of .
///
/// The location to set as data.
+ /// The calculations belonging to the
+ /// for each category boundary.
/// Thrown when
/// is null.
- public HydraulicBoundaryLocationProperties(HydraulicBoundaryLocation location)
+ public HydraulicBoundaryLocationProperties(HydraulicBoundaryLocation location,
+ IEnumerable> calculationPerCategoryBoundary)
{
if (location == null)
{
throw new ArgumentNullException(nameof(location));
}
+ if (calculationPerCategoryBoundary == null)
+ {
+ throw new ArgumentNullException(nameof(calculationPerCategoryBoundary));
+ }
+
Data = location;
+ this.calculationPerCategoryBoundary = calculationPerCategoryBoundary;
}
[PropertyOrder(1)]
@@ -88,6 +102,20 @@
}
}
+ [PropertyOrder(3)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.FailureMechanismAssemblyCategories_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationProperties_CategoryBoundaries_Description))]
+ [TypeConverter(typeof(ExpandableArrayConverter))]
+ public DesignWaterLevelCalculationOutputProperties[] CategoryBoundaries
+ {
+ get
+ {
+ return calculationPerCategoryBoundary.Select(calculation => new DesignWaterLevelCalculationOutputProperties(calculation.Item2,
+ calculation.Item1)).ToArray();
+ }
+ }
+
public override string ToString()
{
return $"{Name} {Location}";
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r04ffe9435f3031323b2eeac4718e85dfd6022dbe -rdd3fbc29b15246ce6d2496e685398011e85bd21d
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -94,6 +94,7 @@
Resources.resx
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationOutputPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationOutputPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationOutputPropertiesTest.cs (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -0,0 +1,271 @@
+// 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 DesignWaterLevelCalculationOutputPropertiesTest
+ {
+ private const int categoryBoundaryNamePropertyIndex = 0;
+ private const int designWaterLevelPropertyIndex = 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_ExpectedValues()
+ {
+ // Setup
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation());
+
+ // Call
+ var properties = new DesignWaterLevelCalculationOutputProperties(hydraulicBoundaryLocationCalculation, "A");
+
+ // 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 DesignWaterLevelCalculationOutputProperties(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 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 DesignWaterLevelCalculationOutputProperties(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 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 categoryBoundaryName = "A";
+ 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 DesignWaterLevelCalculationOutputProperties(hydraulicBoundaryLocationCalculation, categoryBoundaryName);
+
+ // Assert
+ Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, properties.Result);
+ Assert.AreEqual(convergence, properties.Convergence);
+ Assert.AreEqual(categoryBoundaryName, properties.CategoryBoundaryName);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsGroupPropertiesTest.cs
===================================================================
diff -u -rc78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b -rdd3fbc29b15246ce6d2496e685398011e85bd21d
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsGroupPropertiesTest.cs (.../DesignWaterLevelCalculationsGroupPropertiesTest.cs) (revision c78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsGroupPropertiesTest.cs (.../DesignWaterLevelCalculationsGroupPropertiesTest.cs) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -20,8 +20,9 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
-using Core.Common.Base;
+using System.Linq;
using Core.Common.Gui.Converters;
using Core.Common.Gui.PropertyBag;
using Core.Common.TestUtil;
@@ -39,24 +40,38 @@
public void Constructor_LocationsNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new DesignWaterLevelCalculationsGroupProperties(null);
+ TestDelegate call = () => new DesignWaterLevelCalculationsGroupProperties(null,
+ Enumerable.Empty>>());
// Assert
var exception = Assert.Throws(call);
Assert.AreEqual("locations", exception.ParamName);
}
[Test]
+ public void Constructor_CalculationsPerCategoryBoundaryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new DesignWaterLevelCalculationsGroupProperties(Enumerable.Empty(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("calculationsPerCategoryBoundary", exception.ParamName);
+ }
+
+ [Test]
public void Constructor_ExpectedValues()
{
// Setup
- var locations = new ObservableList();
+ IEnumerable locations = Enumerable.Empty();
// Call
- var properties = new DesignWaterLevelCalculationsGroupProperties(locations);
+ var properties = new DesignWaterLevelCalculationsGroupProperties(locations,
+ Enumerable.Empty>>());
// Assert
- Assert.IsInstanceOf>>(properties);
+ Assert.IsInstanceOf>>(properties);
Assert.AreSame(locations, properties.Data);
TestHelper.AssertTypeConverter(
@@ -67,7 +82,8 @@
public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
{
// Call
- var properties = new DesignWaterLevelCalculationsGroupProperties(new ObservableList());
+ var properties = new DesignWaterLevelCalculationsGroupProperties(Enumerable.Empty(),
+ Enumerable.Empty>>());
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
@@ -88,14 +104,22 @@
var location = new TestHydraulicBoundaryLocation();
// Call
- var properties = new DesignWaterLevelCalculationsGroupProperties(new ObservableList
- {
- location
- });
+ var properties = new DesignWaterLevelCalculationsGroupProperties(new[]
+ {
+ location
+ },
+ new[]
+ {
+ new Tuple>("A", new[]
+ {
+ new HydraulicBoundaryLocationCalculation(location)
+ })
+ });
// Assert
- Assert.AreEqual(1, properties.Locations.Length);
- Assert.AreSame(location, properties.Locations[0].Data);
+ HydraulicBoundaryLocationProperties locationProperties = properties.Locations.Single();
+ Assert.AreSame(location, locationProperties.Data);
+ Assert.AreEqual(1, locationProperties.CategoryBoundaries.Length);
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationBasePropertiesTest.cs
===================================================================
diff -u -r04ffe9435f3031323b2eeac4718e85dfd6022dbe -rdd3fbc29b15246ce6d2496e685398011e85bd21d
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationBasePropertiesTest.cs (.../HydraulicBoundaryLocationCalculationBasePropertiesTest.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationBasePropertiesTest.cs (.../HydraulicBoundaryLocationCalculationBasePropertiesTest.cs) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -296,19 +296,21 @@
convergence,
generalResult);
+ var calculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
+ {
+ Output = hydraulicBoundaryLocationCalculationOutput
+ };
+
// Call
- var properties = new TestHydraulicBoundaryLocationCalculationBaseProperties(
- new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation())
- {
- Output = hydraulicBoundaryLocationCalculationOutput
- });
+ var properties = new TestHydraulicBoundaryLocationCalculationBaseProperties(calculation);
// 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);
+ Assert.AreEqual(calculation.InputParameters.ShouldIllustrationPointsBeCalculated, properties.ShouldIllustrationPointsBeCalculated);
if (withIllustrationPoints)
{
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs
===================================================================
diff -u -rc78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b -rdd3fbc29b15246ce6d2496e685398011e85bd21d
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision c78bc8b201c53e91bd6ef0579876cbdcd9dc5b6b)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs (.../HydraulicBoundaryLocationPropertiesTest.cs) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d)
@@ -21,7 +21,9 @@
using System;
using System.ComponentModel;
+using System.Linq;
using Core.Common.Base.Geometry;
+using Core.Common.Gui.Converters;
using Core.Common.Gui.PropertyBag;
using Core.Common.TestUtil;
using NUnit.Framework;
@@ -37,31 +39,48 @@
private const int idPropertyIndex = 0;
private const int namePropertyIndex = 1;
private const int coordinatesPropertyIndex = 2;
+ private const int categoryBoundariesPropertyIndex = 3;
[Test]
public void Constructor_LocationNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new HydraulicBoundaryLocationProperties(null);
+ TestDelegate call = () => new HydraulicBoundaryLocationProperties(null,
+ Enumerable.Empty>());
// Assert
var exception = Assert.Throws(call);
Assert.AreEqual("location", exception.ParamName);
}
[Test]
+ public void Constructor_CalculationPerCategoryBoundaryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new HydraulicBoundaryLocationProperties(new TestHydraulicBoundaryLocation(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("calculationPerCategoryBoundary", exception.ParamName);
+ }
+
+ [Test]
public void Constructor_ExpectedValues()
{
// Setup
var location = new TestHydraulicBoundaryLocation();
// Call
- var properties = new HydraulicBoundaryLocationProperties(location);
+ var properties = new HydraulicBoundaryLocationProperties(location,
+ Enumerable.Empty>());
// Assert
Assert.IsInstanceOf>(properties);
Assert.AreSame(location, properties.Data);
TestHelper.AssertTypeConverter();
+ TestHelper.AssertTypeConverter(
+ nameof(HydraulicBoundaryLocationProperties.CategoryBoundaries));
}
[Test]
@@ -71,11 +90,12 @@
var location = new TestHydraulicBoundaryLocation();
// Call
- var properties = new HydraulicBoundaryLocationProperties(location);
+ var properties = new HydraulicBoundaryLocationProperties(location,
+ Enumerable.Empty>());
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
- Assert.AreEqual(3, dynamicProperties.Count);
+ Assert.AreEqual(4, dynamicProperties.Count);
const string generalCategory = "Algemeen";
@@ -99,6 +119,13 @@
"Coördinaten [m]",
"Coördinaten van de hydraulische randvoorwaardenlocatie.",
true);
+
+ PropertyDescriptor categoryBoundariesProperty = dynamicProperties[categoryBoundariesPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoryBoundariesProperty,
+ generalCategory,
+ "Categoriegrenzen",
+ "De berekeningen per categoriegrens voor deze locatie.",
+ true);
}
[Test]
@@ -111,15 +138,30 @@
const string name = "";
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y);
+ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation)
+ {
+ Output = new TestHydraulicBoundaryLocationCalculationOutput()
+ };
+ var calculations = new[]
+ {
+ new Tuple("A", hydraulicBoundaryLocationCalculation)
+ };
+
// Call
- var properties = new HydraulicBoundaryLocationProperties(hydraulicBoundaryLocation);
+ var properties = new HydraulicBoundaryLocationProperties(hydraulicBoundaryLocation,
+ calculations);
// Assert
Assert.AreEqual(id, properties.Id);
Assert.AreEqual(name, properties.Name);
var coordinates = new Point2D(x, y);
Assert.AreEqual(coordinates, properties.Location);
+
+ DesignWaterLevelCalculationOutputProperties categoryBoundaryCalculation = properties.CategoryBoundaries.Single();
+ Assert.AreEqual("A", categoryBoundaryCalculation.CategoryBoundaryName);
+ Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, categoryBoundaryCalculation.Result);
+ Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.CalculationConvergence, categoryBoundaryCalculation.Convergence);
}
[Test]
@@ -133,7 +175,8 @@
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y);
// Call
- var properties = new HydraulicBoundaryLocationProperties(hydraulicBoundaryLocation);
+ var properties = new HydraulicBoundaryLocationProperties(hydraulicBoundaryLocation,
+ Enumerable.Empty>());
// Assert
string expectedString = $"{name} {new Point2D(x, y)}";