Index: Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRealizationRoundedDoubleElementAttribute.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRealizationRoundedDoubleElementAttribute.cs (revision 0)
+++ Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRealizationRoundedDoubleElementAttribute.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,72 @@
+// 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 Lesser 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser 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.Globalization;
+using System.Reflection;
+using Core.Common.Base.Data;
+
+namespace Core.Common.Gui.Converters
+{
+ ///
+ /// Attribute when using the to define what is
+ /// shown as name and value for each element.
+ ///
+ [AttributeUsage(AttributeTargets.Property)]
+ public class KeyValueAsRealizationRoundedDoubleElementAttribute : KeyValueElementAttribute
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The name of the property to show as name.
+ /// The name of the property to show as value.
+ /// Thrown when any parameter is null.
+ public KeyValueAsRealizationRoundedDoubleElementAttribute(string namePropertyName, string valuePropertyName) : base(namePropertyName, valuePropertyName) {}
+
+ ///
+ /// Gets the property value from the that is used
+ /// as value.
+ ///
+ /// The source to obtain the property value of.
+ /// The value used as value of the property.
+ /// Thrown when the property used for the value of
+ /// the is not found on the
+ /// or if the value is not of type RoundedDouble
+ ///
+ public override string GetValue(object source)
+ {
+ PropertyInfo valuePropertyInfo = source.GetType().GetProperty(ValuePropertyName);
+ if (valuePropertyInfo == null)
+ {
+ throw new ArgumentException($"Value property '{ValuePropertyName}' was not found on type {source.GetType().Name}.");
+ }
+
+ object valueProperty = valuePropertyInfo.GetValue(source, new object[0]);
+ if (!(valueProperty is RoundedDouble))
+ {
+ throw new ArgumentException($"Value property '{ValuePropertyName}' was not of type RoundedDouble.");
+ }
+
+ var doubleValue = (RoundedDouble) valueProperty;
+ return doubleValue.ToString("0.#####", CultureInfo.CurrentCulture);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Converters/KeyValueElementAttribute.cs
===================================================================
diff -u -rb14f45e3735bbdde95f710bf396a85326eb388d5 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Core/Common/src/Core.Common.Gui/Converters/KeyValueElementAttribute.cs (.../KeyValueElementAttribute.cs) (revision b14f45e3735bbdde95f710bf396a85326eb388d5)
+++ Core/Common/src/Core.Common.Gui/Converters/KeyValueElementAttribute.cs (.../KeyValueElementAttribute.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -31,8 +31,8 @@
[AttributeUsage(AttributeTargets.Property)]
public class KeyValueElementAttribute : Attribute
{
+ protected readonly string ValuePropertyName;
private readonly string namePropertyName;
- private readonly string valuePropertyName;
///
/// Creates a new instance of .
@@ -43,7 +43,7 @@
public KeyValueElementAttribute(string namePropertyName, string valuePropertyName)
{
this.namePropertyName = namePropertyName;
- this.valuePropertyName = valuePropertyName;
+ ValuePropertyName = valuePropertyName;
if (valuePropertyName == null)
{
throw new ArgumentNullException(nameof(valuePropertyName));
@@ -83,12 +83,12 @@
/// Thrown when the property used for the value of
/// the is not found on the .
///
- public string GetValue(object source)
+ public virtual string GetValue(object source)
{
- PropertyInfo valuePropertyInfo = source.GetType().GetProperty(valuePropertyName);
+ PropertyInfo valuePropertyInfo = source.GetType().GetProperty(ValuePropertyName);
if (valuePropertyInfo == null)
{
- throw new ArgumentException($"Value property '{valuePropertyName}' was not found on type {source.GetType().Name}.");
+ throw new ArgumentException($"Value property '{ValuePropertyName}' was not found on type {source.GetType().Name}.");
}
return Convert.ToString(valuePropertyInfo.GetValue(source, new object[0]));
Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj
===================================================================
diff -u -r66b001bbe58da39e66aa7d28370ef03fe0a19ad1 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 66b001bbe58da39e66aa7d28370ef03fe0a19ad1)
+++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -121,6 +121,7 @@
+
Index: Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueAsRealizationRoundedDoubleElementAttributeTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueAsRealizationRoundedDoubleElementAttributeTest.cs (revision 0)
+++ Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueAsRealizationRoundedDoubleElementAttributeTest.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,198 @@
+// 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 Lesser 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser 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.Gui.Converters;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+
+namespace Core.Common.Gui.Test.Converters
+{
+ [TestFixture]
+ public class KeyValueAsRealizationRoundedDoubleElementAttributeTest
+ {
+ [Test]
+ public void Constructor_WithoutValuePropertyName_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new KeyValueAsRealizationRoundedDoubleElementAttribute("name", null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("valuePropertyName", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithoutNamePropertyName_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new KeyValueAsRealizationRoundedDoubleElementAttribute(null, "value");
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("namePropertyName", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithParameters_CreatesNewInstance()
+ {
+ // Call
+ var attribute = new KeyValueAsRealizationRoundedDoubleElementAttribute("name", "value");
+
+ // Assert
+ Assert.IsInstanceOf(attribute);
+ }
+
+ [Test]
+ public void GetName_WithObjectWithProperty_ReturnsValueOfProperty()
+ {
+ // Setup
+ const string expectedName = "expectedName";
+
+ var attribute = new KeyValueAsRealizationRoundedDoubleElementAttribute(nameof(TestObject.Name), nameof(TestObject.Value));
+
+ // Call
+ string name = attribute.GetName(new TestObject
+ {
+ Name = expectedName
+ });
+
+ // Assert
+ Assert.AreEqual(expectedName, name);
+ }
+
+ [Test]
+ public void GetName_WithObjectWithNonStringProperty_ReturnsValueOfProperty()
+ {
+ // Setup
+ int expectedName = new Random(21).Next(3, 50);
+
+ var attribute = new KeyValueAsRealizationRoundedDoubleElementAttribute(nameof(TestObject.NonStringName), nameof(TestObject.NonRoundedDoubleValue));
+
+ // Call
+ string name = attribute.GetName(new TestObject
+ {
+ NonStringName = expectedName
+ });
+
+ // Assert
+ Assert.AreEqual(Convert.ToString(expectedName), name);
+ }
+
+ [Test]
+ public void GetName_WithObjectWithoutPropertyWithName_ThrowsArgumentException()
+ {
+ // Setup
+ var attribute = new KeyValueAsRealizationRoundedDoubleElementAttribute("IDoNotExist", nameof(TestObject.Value));
+
+ // Call
+ TestDelegate test = () => attribute.GetName(new TestObject());
+
+ // Assert
+ const string expectedMessage = "Name property 'IDoNotExist' was not found on type TestObject.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void GetValue_WithObjectWithRoundedDoubleProperty_ReturnsValueOfProperty()
+ {
+ // Setup
+ var roundedDoubleValue = new RoundedDouble(5, 5.12345);
+ const string expectedResult = "5.12345";
+
+ var attribute = new KeyValueAsRealizationRoundedDoubleElementAttribute(nameof(TestObject.Name), nameof(TestObject.Value));
+
+ // Call
+ string value = attribute.GetValue(new TestObject
+ {
+ Value = roundedDoubleValue
+ });
+
+ // Assert
+ Assert.AreEqual(expectedResult, value);
+ }
+
+ [Test]
+ [TestCase(5.0000, "5")]
+ [TestCase(-2.12000, "-2.12")]
+ [TestCase(1.24560, "1.2456")]
+ [TestCase(120, "120")]
+ public void GetValue_WithObjectWithRoundedDoubleProperty_ReturnsValueOfPropertyWithoutTrailingZeroes(double doubleValue, string expectedResult)
+ {
+ // Setup
+ var roundedDoubleValue = new RoundedDouble(5, doubleValue);
+
+ var attribute = new KeyValueAsRealizationRoundedDoubleElementAttribute(nameof(TestObject.Name), nameof(TestObject.Value));
+
+ // Call
+ string value = attribute.GetValue(new TestObject
+ {
+ Value = roundedDoubleValue
+ });
+
+ // Assert
+ Assert.AreEqual(expectedResult, value);
+ }
+
+ [Test]
+ public void GetValue_WithObjectWithNonStringProperty_ThrowsArgumentException()
+ {
+ // Setup
+ int expectedValue = new Random(21).Next(3, 50);
+
+ var attribute = new KeyValueAsRealizationRoundedDoubleElementAttribute(nameof(TestObject.NonStringName), nameof(TestObject.NonRoundedDoubleValue));
+
+ // Call
+ TestDelegate test = () => attribute.GetValue(new TestObject
+ {
+ NonRoundedDoubleValue = expectedValue
+ });
+
+ // Assert
+ const string expectedMessage = "Value property 'NonRoundedDoubleValue' was not of type RoundedDouble.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void GetValue_WithObjectWithoutPropertyWithName_ThrowsArgumentException()
+ {
+ // Setup
+ var attribute = new KeyValueAsRealizationRoundedDoubleElementAttribute(nameof(TestObject.Name), "IDoNotExist");
+
+ // Call
+ TestDelegate test = () => attribute.GetValue(new TestObject());
+
+ // Assert
+ const string expectedMessage = "Value property 'IDoNotExist' was not found on type TestObject.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ private class TestObject
+ {
+ public string Name { get; set; }
+ public RoundedDouble Value { get; set; }
+
+ public int NonStringName { get; set; }
+ public int NonRoundedDoubleValue { get; set; }
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj
===================================================================
diff -u -rca27aee933103177a29a8d2ab46e127dbb8bacf6 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision ca27aee933103177a29a8d2ab46e127dbb8bacf6)
+++ Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -93,6 +93,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r83c091ef77a14dc5b4116c628876f49243544aba -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 83c091ef77a14dc5b4116c628876f49243544aba)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -1863,7 +1863,7 @@
}
///
- /// Looks up a localized string similar to .
+ /// Looks up a localized string similar to De lijst van illustratiepunten voor de berekening..
///
public static string IllustrationPointProperty_IllustrationPoints_Description {
get {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -r83c091ef77a14dc5b4116c628876f49243544aba -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 83c091ef77a14dc5b4116c628876f49243544aba)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -1129,7 +1129,7 @@
De schematisatie van de hoogte van het dwarsprofiel.
-
+ De lijst van illustratiepunten voor de berekening.
Illustratiepunten
Fisheye: Tag 3a33e7253e29eb7649dcfc0f675169559b0eefb9 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointBaseProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 3a33e7253e29eb7649dcfc0f675169559b0eefb9 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointChildProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointProperties.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,88 @@
+// 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.Gui.Attributes;
+using Core.Common.Gui.Converters;
+using Core.Common.Utils.Attributes;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Forms.Properties;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// Properties for the fault tree illustration points.
+ ///
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class FaultTreeIllustrationPointProperties : IllustrationPointProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The data to use for the properties.
+ /// String containing the wind direction for this illustration point.
+ /// Thrown when any input parameter is null.
+ /// Thrown when the illustration point node is not of type .
+ public FaultTreeIllustrationPointProperties(
+ IllustrationPointNode illustrationPointNode, string windDirection) : base(illustrationPointNode, windDirection)
+ {
+ if (!(data.Data is FaultTreeIllustrationPoint))
+ {
+ throw new ArgumentException("illustrationPointNode type has to be FaultTreeIllustrationPoint");
+ }
+ }
+
+ [PropertyOrder(4)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_AlphaValues_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_AlphaValues_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Alpha))]
+ public Stochast[] AlphaValues
+ {
+ get
+ {
+ return ((FaultTreeIllustrationPoint) data.Data).Stochasts.ToArray();
+ }
+ }
+
+ [PropertyOrder(5)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Durations_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Durations_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Duration))]
+ public Stochast[] Durations
+ {
+ get
+ {
+ return ((FaultTreeIllustrationPoint) data.Data).Stochasts.ToArray();
+ }
+ }
+
+ public override string ToString()
+ {
+ return $"{Name}";
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3a33e7253e29eb7649dcfc0f675169559b0eefb9 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/IllustrationPointChildProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/IllustrationPointProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/IllustrationPointProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/IllustrationPointProperties.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,153 @@
+// 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.Utils;
+using Core.Common.Utils.Attributes;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// Base properties for the child Illustration Points in a tree.
+ ///
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class IllustrationPointProperties : ObjectProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The data to use for the properties.
+ /// String containing the wind direction for this illustration point.
+ /// Thrown when any input parameter is null.
+ public IllustrationPointProperties(
+ IllustrationPointNode illustrationPointNode, string windDirection)
+ {
+ if (illustrationPointNode == null)
+ {
+ throw new ArgumentNullException(nameof(illustrationPointNode));
+ }
+ if (windDirection == null)
+ {
+ throw new ArgumentNullException(nameof(windDirection));
+ }
+ data = illustrationPointNode;
+ WindDirection = windDirection;
+ }
+
+ [PropertyOrder(0)]
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedProbability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedProbability_Description))]
+ public double CalculatedProbability
+ {
+ get
+ {
+ return StatisticsConverter.ReliabilityToProbability(data.Data.Beta);
+ }
+ }
+
+ [PropertyOrder(1)]
+ [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedReliability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedReliability_Description))]
+ public RoundedDouble Reliability
+ {
+ get
+ {
+ return data.Data.Beta;
+ }
+ }
+
+ [PropertyOrder(2)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_WindDirection_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_WindDirection_Description))]
+ public string WindDirection { get; }
+
+ [PropertyOrder(3)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_ClosingSituation_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_ClosingSituation_Description))]
+ public string Name
+ {
+ get
+ {
+ return data.Data.Name;
+ }
+ }
+
+ [DynamicVisible]
+ [PropertyOrder(6)]
+ [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))]
+ [KeyValueElement(nameof(WindDirection), "")]
+ public IllustrationPointProperties[] IllustrationPoints
+ {
+ get
+ {
+ var points = new List();
+ foreach (IllustrationPointNode illustrationPointNode in data.Children)
+ {
+ if (illustrationPointNode.Data is FaultTreeIllustrationPoint)
+ {
+ points.Add(new FaultTreeIllustrationPointProperties(illustrationPointNode, WindDirection));
+ continue;
+ }
+
+ if (illustrationPointNode.Data is SubMechanismIllustrationPoint)
+ {
+ points.Add(new SubMechanismIllustrationPointProperties(illustrationPointNode, WindDirection));
+ continue;
+ }
+
+ // If type is not supported, throw exception (currently not possible, safeguard for future)
+ throw new NotSupportedException($"IllustrationPointNode of type {nameof(FaultTreeIllustrationPoint)} is not supported. Supported types: {nameof(FaultTreeIllustrationPoint)} and {nameof(SubMechanismIllustrationPoint)}");
+ }
+ return points.ToArray();
+ }
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool IsDynamicVisible(string propertyName)
+ {
+ return propertyName.Equals(nameof(IllustrationPoints)) && data.Children.Any();
+ }
+
+ public override string ToString()
+ {
+ return $"{Name}";
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresOutputProperties.cs
===================================================================
diff -u -r643b5dd9dec0799af47042ce75894b76298fb923 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresOutputProperties.cs (.../StructuresOutputProperties.cs) (revision 643b5dd9dec0799af47042ce75894b76298fb923)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresOutputProperties.cs (.../StructuresOutputProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Core.Common.Base.Data;
@@ -100,12 +101,14 @@
[ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPointProperty_IllustrationPoints_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPointProperty_IllustrationPoints_Description))]
[TypeConverter(typeof(ExpandableArrayConverter))]
- [KeyValueElement(nameof(FaultTreeIllustrationPointBaseProperties.WindDirection), "")]
- public FaultTreeIllustrationPointBaseProperties[] IllustrationPoints
+ public TopLevelFaultTreeIllustrationPointProperties[] IllustrationPoints
{
get
{
- return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new FaultTreeIllustrationPointBaseProperties(point)).ToArray();
+ List listOfClosingSituations = data.GeneralResult.TopLevelIllustrationPoints.Select(topLevelFaultTreeIllustrationPoint =>
+ topLevelFaultTreeIllustrationPoint.ClosingSituation).ToList();
+
+ return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point, listOfClosingSituations.Distinct().Count() > 1)).ToArray();
}
}
@@ -172,15 +175,13 @@
[DynamicVisibleValidationMethod]
public bool DynamicVisibleValidationMethod(string propertyName)
{
- if (propertyName.Equals(nameof(WindDirection)) ||
- propertyName.Equals(nameof(AlphaValues)) ||
- propertyName.Equals(nameof(Durations)) ||
- propertyName.Equals(nameof(IllustrationPoints)))
- {
- return data.HasGeneralResult;
- }
-
- return false;
+ return data.HasGeneralResult &&
+ (
+ propertyName.Equals(nameof(WindDirection)) ||
+ propertyName.Equals(nameof(AlphaValues)) ||
+ propertyName.Equals(nameof(Durations)) ||
+ propertyName.Equals(nameof(IllustrationPoints))
+ );
}
}
}
\ No newline at end of file
Fisheye: Tag 3a33e7253e29eb7649dcfc0f675169559b0eefb9 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointChildProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointProperties.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,97 @@
+// 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.Gui.Attributes;
+using Core.Common.Gui.Converters;
+using Core.Common.Utils.Attributes;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Forms.Properties;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// Properties for the sub mechanism illustration points.
+ ///
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class SubMechanismIllustrationPointProperties : IllustrationPointProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The data to use for the properties.
+ /// String containing the wind direction for this illustration point.
+ /// Thrown when any input parameter is null.
+ /// Thrown when the illustration point node is not of type .
+ public SubMechanismIllustrationPointProperties(
+ IllustrationPointNode illustrationPointNode, string windDirection) : base(illustrationPointNode, windDirection)
+ {
+ if (!(data.Data is SubMechanismIllustrationPoint))
+ {
+ throw new ArgumentException("illustrationPointNode type has to be SubMechanismIllustrationPoint");
+ }
+ }
+
+ [PropertyOrder(4)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_AlphaValues_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_AlphaValues_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueElement(nameof(SubMechanismIllustrationPointStochast.Name), nameof(SubMechanismIllustrationPointStochast.Alpha))]
+ public SubMechanismIllustrationPointStochast[] AlphaValues
+ {
+ get
+ {
+ return ((SubMechanismIllustrationPoint) data.Data).Stochasts.ToArray();
+ }
+ }
+
+ [PropertyOrder(5)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Durations_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Durations_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueElement(nameof(SubMechanismIllustrationPointStochast.Name), nameof(SubMechanismIllustrationPointStochast.Duration))]
+ public SubMechanismIllustrationPointStochast[] Durations
+ {
+ get
+ {
+ return ((SubMechanismIllustrationPoint) data.Data).Stochasts.ToArray();
+ }
+ }
+
+ [PropertyOrder(6)]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_Realization_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_Realization_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueAsRealizationRoundedDoubleElement(nameof(Stochast.Name), nameof(SubMechanismIllustrationPointStochast.Realization))]
+ public SubMechanismIllustrationPointStochast[] SubMechanismStochasts
+ {
+ get
+ {
+ return ((SubMechanismIllustrationPoint) data.Data).Stochasts.ToArray();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelFaultTreeIllustrationPointProperties.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelFaultTreeIllustrationPointProperties.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelFaultTreeIllustrationPointProperties.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,176 @@
+// 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.Utils;
+using Core.Common.Utils.Attributes;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Common.Forms.PropertyClasses
+{
+ ///
+ /// Properties for the fault tree illustration points.
+ ///
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class TopLevelFaultTreeIllustrationPointProperties : ObjectProperties
+ {
+ private readonly bool showClosingSituation;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The data to use for the properties.
+ /// Thrown when any input parameter is null.
+ public TopLevelFaultTreeIllustrationPointProperties(
+ TopLevelFaultTreeIllustrationPoint faultTreeData, bool hasUniqueClosingSituations = false)
+ {
+ if (faultTreeData == null)
+ {
+ throw new ArgumentNullException(nameof(faultTreeData));
+ }
+ data = faultTreeData;
+ showClosingSituation = hasUniqueClosingSituations;
+ }
+
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedProbability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedProbability_Description))]
+ public double CalculatedProbability
+ {
+ get
+ {
+ return StatisticsConverter.ReliabilityToProbability(data.FaultTreeNodeRoot.Data.Beta);
+ }
+ }
+
+ [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedReliability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.CalculationOutput_CalculatedReliability_Description))]
+ public RoundedDouble Reliability
+ {
+ get
+ {
+ return data.FaultTreeNodeRoot.Data.Beta;
+ }
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_WindDirection_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_WindDirection_Description))]
+ public string WindDirection
+ {
+ get
+ {
+ return data.WindDirection.Name;
+ }
+ }
+
+ [DynamicVisible]
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_ClosingSituation_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_ClosingSituation_Description))]
+ public string ClosingSituation
+ {
+ get
+ {
+ return data.ClosingSituation;
+ }
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_AlphaValues_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_AlphaValues_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Alpha))]
+ public Stochast[] AlphaValues
+ {
+ get
+ {
+ return ((FaultTreeIllustrationPoint) data.FaultTreeNodeRoot.Data).Stochasts.ToArray();
+ }
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Durations_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Durations_Description))]
+ [TypeConverter(typeof(KeyValueExpandableArrayConverter))]
+ [KeyValueElement(nameof(Stochast.Name), nameof(Stochast.Duration))]
+ public Stochast[] Durations
+ {
+ get
+ {
+ return ((FaultTreeIllustrationPoint) data.FaultTreeNodeRoot.Data).Stochasts.ToArray();
+ }
+ }
+
+ [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 IllustrationPointProperties[] IllustrationPoints
+ {
+ get
+ {
+ var points = new List();
+ foreach (IllustrationPointNode illustrationPointNode in data.FaultTreeNodeRoot.Children)
+ {
+ if (illustrationPointNode.Data is FaultTreeIllustrationPoint)
+ {
+ points.Add(new FaultTreeIllustrationPointProperties(illustrationPointNode, WindDirection));
+ continue;
+ }
+
+ if (illustrationPointNode.Data is SubMechanismIllustrationPoint)
+ {
+ points.Add(new SubMechanismIllustrationPointProperties(illustrationPointNode, WindDirection));
+ continue;
+ }
+
+ // If type is not supported, throw exception (currently not possible, safeguard for future)
+ throw new NotSupportedException($"IllustrationPointNode of type {nameof(FaultTreeIllustrationPoint)} is not supported. Supported types: {nameof(FaultTreeIllustrationPoint)} and {nameof(SubMechanismIllustrationPoint)}");
+ }
+ return points.ToArray();
+ }
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool DynamicVisibleValidationMethod(string propertyName)
+ {
+ return propertyName.Equals(nameof(ClosingSituation)) && showClosingSituation;
+ }
+
+ public override string ToString()
+ {
+ return $"{WindDirection}";
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -81,10 +81,10 @@
True
Resources.resx
-
-
-
-
+
+
+
+
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestFaultTreeIllustrationPointTest.cs
===================================================================
diff -u -rb7f14623d48e8451968836803a80cd9d51492164 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestFaultTreeIllustrationPointTest.cs (.../TestFaultTreeIllustrationPointTest.cs) (revision b7f14623d48e8451968836803a80cd9d51492164)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestFaultTreeIllustrationPointTest.cs (.../TestFaultTreeIllustrationPointTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Linq;
using NUnit.Framework;
using Ringtoets.Common.Data.IllustrationPoints;
using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
@@ -43,7 +44,7 @@
}
[Test]
- public void ParameteredConstructor_ExpectedValues()
+ public void ParameteredConstructor_WithBeta_ExpectedValues()
{
// Setup
const double beta = 1.23;
@@ -58,5 +59,42 @@
CollectionAssert.IsEmpty(illustrationPoint.Stochasts);
Assert.AreEqual(beta, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy());
}
+
+ [Test]
+ public void ParameteredConstructor_WithName_ExpectedValues()
+ {
+ // Call
+ var illustrationPoint = new TestFaultTreeIllustrationPoint("Test Name");
+
+ // Assert
+ Assert.IsInstanceOf(illustrationPoint);
+
+ Assert.AreEqual("Test Name", illustrationPoint.Name);
+ CollectionAssert.IsEmpty(illustrationPoint.Stochasts);
+ Assert.AreEqual(3.14, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy());
+ }
+
+ [Test]
+ public void ParameteredConstructor_WithStochast_ExpectedValues()
+ {
+ // Setup
+ var stochast = new Stochast("Stochast 1", 5.0, 10.0);
+
+ // Call
+ var illustrationPoint = new TestFaultTreeIllustrationPoint(new[]
+ {
+ stochast
+ });
+
+ // Assert
+ Assert.IsInstanceOf(illustrationPoint);
+
+ Assert.AreEqual("Illustration Point", illustrationPoint.Name);
+ Assert.AreEqual(3.14, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy());
+ Assert.IsNotEmpty(illustrationPoint.Stochasts);
+ Assert.AreEqual(stochast.Name, illustrationPoint.Stochasts.First().Name);
+ Assert.AreEqual(stochast.Alpha, illustrationPoint.Stochasts.First().Alpha);
+ Assert.AreEqual(stochast.Duration, illustrationPoint.Stochasts.First().Duration);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestSubMechanismIllustrationPointTest.cs
===================================================================
diff -u -r373e1f071d233dc36d360e9904fa6718af742200 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestSubMechanismIllustrationPointTest.cs (.../TestSubMechanismIllustrationPointTest.cs) (revision 373e1f071d233dc36d360e9904fa6718af742200)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestSubMechanismIllustrationPointTest.cs (.../TestSubMechanismIllustrationPointTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Linq;
using NUnit.Framework;
using Ringtoets.Common.Data.IllustrationPoints;
using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
@@ -44,7 +45,7 @@
}
[Test]
- public void ParameteredConstructor_ExpectedValues()
+ public void ParameteredConstructor_WithBeta_ExpectedValues()
{
// Setup
const double beta = 1.23;
@@ -60,5 +61,44 @@
CollectionAssert.IsEmpty(illustrationPoint.IllustrationPointResults);
Assert.AreEqual(beta, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy());
}
+
+ [Test]
+ public void ParameteredConstructor_WithStochasts_ExpectedValues()
+ {
+ // Setup
+ var stochasts = new[]
+ {
+ new SubMechanismIllustrationPointStochast("Stochast A", 3.0, 0.5, 12.0)
+ };
+
+ // Call
+ var illustrationPoint = new TestSubMechanismIllustrationPoint(stochasts);
+
+ // Assert
+ Assert.IsInstanceOf(illustrationPoint);
+
+ Assert.AreEqual("Illustration Point", illustrationPoint.Name);
+ Assert.AreEqual(3.14, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy());
+
+ Assert.IsNotEmpty(illustrationPoint.Stochasts);
+ Assert.AreEqual("Stochast A", illustrationPoint.Stochasts.First().Name);
+ Assert.AreEqual(3.0, illustrationPoint.Stochasts.First().Duration);
+ Assert.AreEqual(0.5, illustrationPoint.Stochasts.First().Alpha);
+ Assert.AreEqual(12.0, illustrationPoint.Stochasts.First().Realization);
+ }
+
+ [Test]
+ public void ParameteredConstructor_WithName_ExpectedValues()
+ {
+ // Call
+ var illustrationPoint = new TestSubMechanismIllustrationPoint("Testing Name");
+
+ // Assert
+ Assert.IsInstanceOf(illustrationPoint);
+
+ Assert.AreEqual("Testing Name", illustrationPoint.Name);
+ CollectionAssert.IsEmpty(illustrationPoint.Stochasts);
+ Assert.AreEqual(3.14, illustrationPoint.Beta, illustrationPoint.Beta.GetAccuracy());
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestFaultTreeIllustrationPoint.cs
===================================================================
diff -u -rb7f14623d48e8451968836803a80cd9d51492164 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestFaultTreeIllustrationPoint.cs (.../TestFaultTreeIllustrationPoint.cs) (revision b7f14623d48e8451968836803a80cd9d51492164)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestFaultTreeIllustrationPoint.cs (.../TestFaultTreeIllustrationPoint.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Collections.Generic;
using System.Linq;
using Ringtoets.Common.Data.IllustrationPoints;
@@ -38,6 +39,26 @@
///
/// Creates a new instance of .
///
+ /// The name of the illustration point.
+ public TestFaultTreeIllustrationPoint(string name)
+ : base(name,
+ 3.14,
+ Enumerable.Empty(),
+ CombinationType.And) {}
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The stochasts of the illustration point.
+ public TestFaultTreeIllustrationPoint(IEnumerable stochasts)
+ : base("Illustration Point",
+ 3.14,
+ stochasts,
+ CombinationType.And) {}
+
+ ///
+ /// Creates a new instance of .
+ ///
/// The beta of the illustration point.
public TestFaultTreeIllustrationPoint(double beta)
: base("Illustration Point",
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPoint.cs
===================================================================
diff -u -r4a73a8a56bdfc43d45d691fa4dbc251bbb261085 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPoint.cs (.../TestSubMechanismIllustrationPoint.cs) (revision 4a73a8a56bdfc43d45d691fa4dbc251bbb261085)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestSubMechanismIllustrationPoint.cs (.../TestSubMechanismIllustrationPoint.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Collections.Generic;
using System.Linq;
using Ringtoets.Common.Data.IllustrationPoints;
@@ -38,6 +39,26 @@
///
/// Creates a new instance of .
///
+ /// The name of the illustration point.
+ public TestSubMechanismIllustrationPoint(string name)
+ : base(name,
+ 3.14,
+ Enumerable.Empty(),
+ Enumerable.Empty()) {}
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The stochasts of the illustration point.
+ public TestSubMechanismIllustrationPoint(IEnumerable stochasts)
+ : base("Illustration Point",
+ 3.14,
+ stochasts,
+ Enumerable.Empty()) {}
+
+ ///
+ /// Creates a new instance of .
+ ///
/// The beta of the illustration point.
public TestSubMechanismIllustrationPoint(double beta)
: base("Illustration Point",
Fisheye: Tag 3a33e7253e29eb7649dcfc0f675169559b0eefb9 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointBasePropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 3a33e7253e29eb7649dcfc0f675169559b0eefb9 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointChildPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointPropertiesTest.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,243 @@
+// 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.TestUtil;
+using Core.Common.Utils;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class FaultTreeIllustrationPointPropertiesTest
+ {
+ private const int probabilityPropertyIndex = 0;
+ private const int reliabilityPropertyIndex = 1;
+ private const int windDirectionPropertyIndex = 2;
+ private const int closingScenarioPropertyIndex = 3;
+ private const int alphasPropertyIndex = 4;
+ private const int durationsPropertyIndex = 5;
+ private const int illustrationPointPropertyIndex = 6;
+
+ private const string illustrationPointsCategoryName = "Illustratiepunten";
+
+ [Test]
+ public void Constructor_InvalidIllustrationPointType_ThrowsArgumentException()
+ {
+ // Setup
+ const string expectedMessage = "illustrationPointNode type has to be FaultTreeIllustrationPoint";
+
+ // Call
+ TestDelegate test = () => new FaultTreeIllustrationPointProperties(new IllustrationPointNode(new TestSubMechanismIllustrationPoint()), "N");
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void Constructor_FaultTreeIllustrationPoint_ReturnsExpectedValues()
+ {
+ // Setup
+ var illustrationPointNode = new IllustrationPointNode(new TestFaultTreeIllustrationPoint(new[]
+ {
+ new Stochast("Stochast A", 10.0, 2.5)
+ }));
+ var illustrationPointNodeChild = new IllustrationPointNode(new TestFaultTreeIllustrationPoint());
+ illustrationPointNode.SetChildren(new[]
+ {
+ illustrationPointNodeChild,
+ illustrationPointNodeChild
+ });
+
+ // Call
+ var faultTree = new FaultTreeIllustrationPointProperties(illustrationPointNode, "NNE");
+
+ // Assert
+ Assert.AreEqual("NNE", faultTree.WindDirection);
+ Assert.AreEqual(3.14, faultTree.Reliability.Value);
+ Assert.AreEqual(5, faultTree.Reliability.NumberOfDecimalPlaces);
+ Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), faultTree.CalculatedProbability);
+ Assert.AreEqual("Illustration Point", faultTree.Name);
+
+ Assert.IsNotEmpty(faultTree.AlphaValues);
+ Assert.AreEqual(1, faultTree.AlphaValues.Length);
+ Assert.AreEqual(2.5, faultTree.AlphaValues.First().Alpha);
+
+ Assert.IsNotEmpty(faultTree.Durations);
+ Assert.AreEqual(1, faultTree.Durations.Length);
+ Assert.AreEqual(10.0, faultTree.Durations.First().Duration);
+
+ Assert.IsNotNull(faultTree.IllustrationPoints);
+ Assert.AreEqual(2, faultTree.IllustrationPoints.Length);
+ Assert.AreEqual("NNE", faultTree.IllustrationPoints[0].WindDirection);
+ Assert.AreEqual("Illustration Point", faultTree.IllustrationPoints[0].Name);
+ Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), faultTree.IllustrationPoints[0].CalculatedProbability);
+ Assert.AreEqual(3.14, faultTree.IllustrationPoints[0].Reliability);
+ Assert.AreEqual(0, faultTree.IllustrationPoints[0].IllustrationPoints.Length);
+ }
+
+ [Test]
+ public void VisibleProperties_WithChildIllustrationPointNodes_ExpectedAttributesValues()
+ {
+ // Setup
+ var illustrationPointNode = new IllustrationPointNode(new TestFaultTreeIllustrationPoint());
+ illustrationPointNode.SetChildren(new[]
+ {
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint()),
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint())
+ });
+
+ // Call
+ var faultTree = new FaultTreeIllustrationPointProperties(illustrationPointNode, "N");
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree);
+ Assert.AreEqual(7, dynamicProperties.Count);
+
+ PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty,
+ illustrationPointsCategoryName,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty,
+ illustrationPointsCategoryName,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
+ illustrationPointsCategoryName,
+ "Windrichting",
+ "De windrichting waarvoor dit illlustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor closingScenarioProperty = dynamicProperties[closingScenarioPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty,
+ illustrationPointsCategoryName,
+ "Sluitscenario",
+ "Het sluitscenario waarvoor dit illustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty,
+ illustrationPointsCategoryName,
+ "Alfa's [-]",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
+ illustrationPointsCategoryName,
+ "Tijdsduren [min]",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+
+ PropertyDescriptor illustrationPointProperty = dynamicProperties[illustrationPointPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
+ illustrationPointsCategoryName,
+ "Illustratiepunten",
+ "De lijst van illustratiepunten voor de berekening.",
+ true);
+ }
+
+ [Test]
+ public void VisibleProperties_WithoutChildIllustrationPointNodes_ExpectedAttributesValues()
+ {
+ // Setup
+ var faultTree = new FaultTreeIllustrationPointProperties(
+ new IllustrationPointNode(
+ new TestFaultTreeIllustrationPoint()), "N");
+
+ // Call
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree);
+
+ // Assert
+ Assert.AreEqual(6, dynamicProperties.Count);
+
+ PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty,
+ illustrationPointsCategoryName,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty,
+ illustrationPointsCategoryName,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
+ illustrationPointsCategoryName,
+ "Windrichting",
+ "De windrichting waarvoor dit illlustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor closingScenarioProperty = dynamicProperties[closingScenarioPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty,
+ illustrationPointsCategoryName,
+ "Sluitscenario",
+ "Het sluitscenario waarvoor dit illustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty,
+ illustrationPointsCategoryName,
+ "Alfa's [-]",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
+ illustrationPointsCategoryName,
+ "Tijdsduren [min]",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+ }
+
+ [Test]
+ public void ToString_CorrectValue_ReturnsCorrectString()
+ {
+ // Setup
+ var faultTreeProperties = new FaultTreeIllustrationPointProperties(
+ new IllustrationPointNode(
+ new TestFaultTreeIllustrationPoint("VeryImportant")),
+ "NotImportant");
+
+ // Call
+ string toString = faultTreeProperties.ToString();
+
+ // Assert
+ Assert.AreEqual(toString, "VeryImportant");
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3a33e7253e29eb7649dcfc0f675169559b0eefb9 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointChildPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointPropertiesTest.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,211 @@
+// 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.TestUtil;
+using Core.Common.Utils;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class IllustrationPointPropertiesTest
+ {
+ private const string illustrationPointCategoryName = "Illustratiepunten";
+
+ [Test]
+ public void Constructor_IllustrationPointNodeNull_ThrowsException()
+ {
+ // Call
+ TestDelegate test = () => new IllustrationPointProperties(null, "Point name A");
+
+ // Assert
+ const string expectedMessage = "Value cannot be null.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void Constructor_WindDirectionNull_ThrowsException()
+ {
+ // Call
+ TestDelegate test = () => new IllustrationPointProperties(new IllustrationPointNode(new TestIllustrationPoint()), null);
+
+ // Assert
+ const string expectedMessage = "Value cannot be null.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void Constructor_FaultTreeIllustrationPointWithoutChildren_CorrectValues()
+ {
+ // Call
+ var faultTree = new IllustrationPointProperties(new IllustrationPointNode(new TestFaultTreeIllustrationPoint()), "NNE");
+
+ // Assert
+ Assert.AreEqual("NNE", faultTree.WindDirection);
+ Assert.AreEqual(3.14, faultTree.Reliability.Value);
+ Assert.AreEqual(5, faultTree.Reliability.NumberOfDecimalPlaces);
+ Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), faultTree.CalculatedProbability);
+ Assert.AreEqual("Illustration Point", faultTree.Name);
+
+ Assert.IsNotNull(faultTree.IllustrationPoints);
+ Assert.AreEqual(0, faultTree.IllustrationPoints.Length);
+ }
+
+ [Test]
+ public void Constructor_FaultTreeIllustrationPointWithChildren_CorrectValues()
+ {
+ // Setup
+ var illustrationPointNode = new IllustrationPointNode(new TestSubMechanismIllustrationPoint());
+ illustrationPointNode.SetChildren(new[]
+ {
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint()),
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint())
+ });
+
+ // Call
+ var faultTree = new IllustrationPointProperties(illustrationPointNode, "N");
+
+ // Assert
+ Assert.AreEqual("N", faultTree.WindDirection);
+ Assert.AreEqual(3.14, faultTree.Reliability.Value);
+ Assert.AreEqual(5, faultTree.Reliability.NumberOfDecimalPlaces);
+ Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), faultTree.CalculatedProbability);
+ Assert.AreEqual("Illustration Point", faultTree.Name);
+
+ Assert.IsNotNull(faultTree.IllustrationPoints);
+ Assert.AreEqual(2, faultTree.IllustrationPoints.Length);
+ }
+
+ [Test]
+ public void ToString_CorrectValue_ReturnsCorrectString()
+ {
+ // Setup
+ var faultTree = new IllustrationPointProperties(new IllustrationPointNode(new TestFaultTreeIllustrationPoint("ImportantName")),
+ "NotImportant");
+
+ // Call
+ string toString = faultTree.ToString();
+
+ // Assert
+ Assert.AreEqual("ImportantName", toString);
+ }
+
+ [Test]
+ public void Constructor_WithChildIllustrationPointNodes_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var illustrationPointNode = new IllustrationPointNode(new TestFaultTreeIllustrationPoint());
+ illustrationPointNode.SetChildren(new[]
+ {
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint()),
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint())
+ });
+
+ // Call
+ var faultTree = new IllustrationPointProperties(illustrationPointNode, "N");
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree);
+ Assert.AreEqual(5, dynamicProperties.Count);
+
+ PropertyDescriptor probabilityProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty,
+ illustrationPointCategoryName,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor reliabilityProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty,
+ illustrationPointCategoryName,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor windDirectionProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
+ illustrationPointCategoryName,
+ "Windrichting",
+ "De windrichting waarvoor dit illlustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor closingScenarioProperty = dynamicProperties[3];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty,
+ illustrationPointCategoryName,
+ "Sluitscenario",
+ "Het sluitscenario waarvoor dit illustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor illustrationPointProperty = dynamicProperties[4];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
+ illustrationPointCategoryName,
+ "Illustratiepunten",
+ "De lijst van illustratiepunten voor de berekening.",
+ true);
+ }
+
+ [Test]
+ public void Constructor_WithoutChildIllustrationPointNodes_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var illustrationPointNode = new IllustrationPointNode(new TestSubMechanismIllustrationPoint());
+ // Call
+ var faultTree = new IllustrationPointProperties(illustrationPointNode, "N");
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree);
+ Assert.AreEqual(4, dynamicProperties.Count);
+
+ PropertyDescriptor probabilityProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty,
+ illustrationPointCategoryName,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor reliabilityProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty,
+ illustrationPointCategoryName,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor windDirectionProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
+ illustrationPointCategoryName,
+ "Windrichting",
+ "De windrichting waarvoor dit illlustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor closingScenarioProperty = dynamicProperties[3];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty,
+ illustrationPointCategoryName,
+ "Sluitscenario",
+ "Het sluitscenario waarvoor dit illustratiepunt is berekend.",
+ true);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresOutputPropertiesTest.cs
===================================================================
diff -u -rabe2b6b2a8e30fb019e06f1d0b9834d29acbe9a3 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresOutputPropertiesTest.cs (.../StructuresOutputPropertiesTest.cs) (revision abe2b6b2a8e30fb019e06f1d0b9834d29acbe9a3)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresOutputPropertiesTest.cs (.../StructuresOutputPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -58,8 +58,8 @@
{
// Setup
GeneralResult generalResult = withIllustrationPoints
- ? new TestGeneralResultFaultTreeIllustrationPoint()
- : null;
+ ? new TestGeneralResultFaultTreeIllustrationPoint()
+ : null;
var structuresOutput = new StructuresOutput(new TestProbabilityAssessmentOutput(), generalResult);
@@ -100,17 +100,15 @@
factorOfSafety);
var generalResult = new TestGeneralResultFaultTreeIllustrationPoint();
- var expectedFaultTreeIllustrationPointBaseProperty = new[]
- {
- new FaultTreeIllustrationPointBaseProperties(generalResult.TopLevelIllustrationPoints.First())
- };
var structuresOutput = new StructuresOutput(probabilityAssessmentOutput, generalResult);
// Call
var properties = new StructuresOutputProperties(structuresOutput);
// Assert
+ var expectedFaultTreeIllustrationPointBaseProperty = new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First());
+
Assert.AreEqual(ProbabilityFormattingHelper.Format(requiredProbability), properties.RequiredProbability);
Assert.AreEqual(requiredReliability, properties.RequiredReliability, properties.RequiredReliability.GetAccuracy());
Assert.AreEqual(ProbabilityFormattingHelper.Format(probability), properties.Probability);
@@ -119,18 +117,18 @@
Assert.AreEqual(generalResult.GoverningWindDirection.Name, properties.WindDirection);
Assert.AreEqual(5.0, properties.AlphaValues[0].Alpha);
Assert.AreEqual(10.0, properties.Durations[0].Duration);
- Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty[0].WindDirection, properties.IllustrationPoints[0].WindDirection);
- Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty[0].Reliability, properties.IllustrationPoints[0].Reliability);
- Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty[0].CalculatedProbability, properties.IllustrationPoints[0].CalculatedProbability);
- Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty[0].ClosingSituation, properties.IllustrationPoints[0].ClosingSituation);
- Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty[0].IllustrationPoints, properties.IllustrationPoints[0].IllustrationPoints);
+ Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty.WindDirection, properties.IllustrationPoints[0].WindDirection);
+ Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty.Reliability, properties.IllustrationPoints[0].Reliability);
+ Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty.CalculatedProbability, properties.IllustrationPoints[0].CalculatedProbability);
+ Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty.ClosingSituation, properties.IllustrationPoints[0].ClosingSituation);
+ Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty.IllustrationPoints, properties.IllustrationPoints[0].IllustrationPoints);
}
[Test]
public void Constructor_HasGeneralResult_PropertiesHaveExpectedAttributesValues()
{
// Setup
- var probabilityAssessmentOutput = new ProbabilityAssessmentOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN);
+ var probabilityAssessmentOutput = new TestProbabilityAssessmentOutput();
var generalResult = new TestGeneralResultFaultTreeIllustrationPoint();
var structuresOutput = new StructuresOutput(probabilityAssessmentOutput, generalResult);
@@ -201,15 +199,15 @@
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
illustrationPointsCategoryName,
"Illustratiepunten",
- "",
+ "De lijst van illustratiepunten voor de berekening.",
true);
}
[Test]
public void Constructor_NoGeneralResult_PropertiesHaveExpectedAttributesValues()
{
// Setup
- var probabilityAssessmentOutput = new ProbabilityAssessmentOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN);
+ var probabilityAssessmentOutput = new TestProbabilityAssessmentOutput();
var structuresOutput = new StructuresOutput(probabilityAssessmentOutput, null);
// Call
Fisheye: Tag 3a33e7253e29eb7649dcfc0f675169559b0eefb9 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointChildPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,169 @@
+// 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.TestUtil;
+using Core.Common.Utils;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class SubMechanismIllustrationPointPropertiesTest
+ {
+ private const int probabilityPropertyIndex = 0;
+ private const int reliabilityPropertyIndex = 1;
+ private const int windDirectionPropertyIndex = 2;
+ private const int closingScenarioPropertyIndex = 3;
+ private const int alphasPropertyIndex = 4;
+ private const int durationsPropertyIndex = 5;
+ private const int subMechanismStochastPropertyIndex = 6;
+
+ private const string illustrationPointsCategoryName = "Illustratiepunten";
+
+ [Test]
+ public void Constructor_InvalidIllustrationPointType_ThrowsArgumentException()
+ {
+ // Call
+ TestDelegate test = () => new SubMechanismIllustrationPointProperties(new IllustrationPointNode(
+ new TestIllustrationPoint()),
+ "N");
+
+ // Assert
+ const string expectedMessage = "illustrationPointNode type has to be SubMechanismIllustrationPoint";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void Constructor_FaultTreeIllustrationPoint_CorrectValues()
+ {
+ // Call
+ var subMechanismProperties = new SubMechanismIllustrationPointProperties(new IllustrationPointNode(
+ new TestSubMechanismIllustrationPoint(new[]
+ {
+ new SubMechanismIllustrationPointStochast("Test", 2.0, 4.5, 0.1)
+ })),
+ "N");
+
+ // Assert
+ Assert.AreEqual("N", subMechanismProperties.WindDirection);
+ Assert.AreEqual(3.14, subMechanismProperties.Reliability.Value);
+ Assert.AreEqual(5, subMechanismProperties.Reliability.NumberOfDecimalPlaces);
+ Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), subMechanismProperties.CalculatedProbability);
+ Assert.AreEqual("Illustration Point", subMechanismProperties.Name);
+
+ Assert.IsNotEmpty(subMechanismProperties.AlphaValues);
+ Assert.AreEqual(1, subMechanismProperties.AlphaValues.Length);
+ Assert.AreEqual(4.5, subMechanismProperties.AlphaValues.First().Alpha);
+
+ Assert.IsNotEmpty(subMechanismProperties.Durations);
+ Assert.AreEqual(1, subMechanismProperties.Durations.Length);
+ Assert.AreEqual(2.0, subMechanismProperties.Durations.First().Duration);
+
+ Assert.IsNotEmpty(subMechanismProperties.SubMechanismStochasts);
+ Assert.AreEqual(1, subMechanismProperties.SubMechanismStochasts.Length);
+ Assert.AreEqual(0.1, subMechanismProperties.SubMechanismStochasts.First().Realization);
+
+ Assert.IsEmpty(subMechanismProperties.IllustrationPoints);
+ Assert.AreEqual(0, subMechanismProperties.IllustrationPoints.Length);
+ }
+
+ [Test]
+ public void Constructor_WithSubMechanismIllustrationPoint_PropertiesHaveExpectedAttributesValues()
+ {
+ // Call
+ var subMechanismProperties = new SubMechanismIllustrationPointProperties(new IllustrationPointNode(new TestSubMechanismIllustrationPoint()), "N");
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(subMechanismProperties);
+ Assert.AreEqual(7, dynamicProperties.Count);
+
+ PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty,
+ illustrationPointsCategoryName,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty,
+ illustrationPointsCategoryName,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
+ illustrationPointsCategoryName,
+ "Windrichting",
+ "De windrichting waarvoor dit illlustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor closingScenarioProperty = dynamicProperties[closingScenarioPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty,
+ illustrationPointsCategoryName,
+ "Sluitscenario",
+ "Het sluitscenario waarvoor dit illustratiepunt is berekend.",
+ true);
+
+ PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty,
+ illustrationPointsCategoryName,
+ "Alfa's [-]",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
+ illustrationPointsCategoryName,
+ "Tijdsduren [min]",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+
+ PropertyDescriptor subMechanismStochastProperty = dynamicProperties[subMechanismStochastPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(subMechanismStochastProperty,
+ illustrationPointsCategoryName,
+ "Waarden in het illustratiepunt",
+ "Realisaties van de stochasten in het illustratiepunt",
+ true);
+ }
+
+ [Test]
+ public void ToString_CorrectValue_ReturnsCorrectString()
+ {
+ // Setup
+ var subMechanismProperties = new SubMechanismIllustrationPointProperties(
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint("Relevant")),
+ "NotRelevant");
+
+ // Call
+ string toString = subMechanismProperties.ToString();
+
+ // Assert
+ Assert.AreEqual(toString, "Relevant");
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelFaultTreeIllustrationPointPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelFaultTreeIllustrationPointPropertiesTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelFaultTreeIllustrationPointPropertiesTest.cs (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -0,0 +1,177 @@
+// 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.TestUtil;
+using Core.Common.Utils;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Common.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class TopLevelFaultTreeIllustrationPointPropertiesTest
+ {
+ [Test]
+ public void Constructor_Null_ThrowsException()
+ {
+ // Call
+ TestDelegate test = () => new TopLevelFaultTreeIllustrationPointProperties(null);
+
+ // Assert
+ const string expectedMessage = "Value cannot be null.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void Constructor_FaultTreeIllustrationPoint_CorrectValues()
+ {
+ // Setup
+ var topLevel = new TopLevelFaultTreeIllustrationPoint(
+ new WindDirection("N", 5.0),
+ "closing situation",
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint(new[]
+ {
+ new Stochast("Stochast A", 2.5, 5.5)
+ })));
+
+ topLevel.FaultTreeNodeRoot.SetChildren(new[]
+ {
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint()),
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint())
+ });
+
+ // Call
+ var faultTree = new TopLevelFaultTreeIllustrationPointProperties(topLevel);
+
+ // Assert
+ Assert.AreEqual("N", faultTree.WindDirection);
+ Assert.AreEqual(3.14, faultTree.Reliability.Value);
+ Assert.AreEqual(5, faultTree.Reliability.NumberOfDecimalPlaces);
+ Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), faultTree.CalculatedProbability);
+ Assert.AreEqual("closing situation", faultTree.ClosingSituation);
+
+ Assert.IsNotNull(faultTree.AlphaValues);
+ Assert.AreEqual(1, faultTree.AlphaValues.Length);
+ Assert.AreEqual(5.5, faultTree.AlphaValues[0].Alpha);
+
+ Assert.IsNotNull(faultTree.Durations);
+ Assert.AreEqual(1, faultTree.Durations.Length);
+ Assert.AreEqual(2.5, faultTree.Durations[0].Duration);
+
+ Assert.IsNotNull(faultTree.IllustrationPoints);
+ Assert.AreEqual(2, faultTree.IllustrationPoints.Length);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues(bool showClosingSituations)
+ {
+ // Setup
+ var topLevel = new TopLevelFaultTreeIllustrationPoint(
+ new WindDirection("N", 5.0),
+ "closing situation",
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint()));
+
+ // Call
+ var topLevelFaultTree = new TopLevelFaultTreeIllustrationPointProperties(topLevel, showClosingSituations);
+
+ // Assert
+ const string illustrationPointsCategoryName = "Illustratiepunten";
+ int closingSituationIndexOffset = showClosingSituations ? 1 : 0;
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(topLevelFaultTree);
+ Assert.AreEqual(6 + closingSituationIndexOffset, dynamicProperties.Count);
+
+ PropertyDescriptor probabilityProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty,
+ illustrationPointsCategoryName,
+ "Berekende kans [1/jaar]",
+ "De berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor reliabilityProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty,
+ illustrationPointsCategoryName,
+ "Betrouwbaarheidsindex berekende kans [-]",
+ "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
+ true);
+
+ PropertyDescriptor windDirectionProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
+ illustrationPointsCategoryName,
+ "Windrichting",
+ "De windrichting waarvoor dit illlustratiepunt is berekend.",
+ true);
+
+ if (showClosingSituations)
+ {
+ PropertyDescriptor closingSituationProperty = dynamicProperties[3];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingSituationProperty,
+ illustrationPointsCategoryName,
+ "Sluitscenario",
+ "Het sluitscenario waarvoor dit illustratiepunt is berekend.",
+ true);
+ }
+
+ PropertyDescriptor alphasProperty = dynamicProperties[3 + closingSituationIndexOffset];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty,
+ illustrationPointsCategoryName,
+ "Alfa's [-]",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ PropertyDescriptor durationsProperty = dynamicProperties[4 + closingSituationIndexOffset];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
+ illustrationPointsCategoryName,
+ "Tijdsduren [min]",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+
+ PropertyDescriptor illustrationPointProperty = dynamicProperties[5 + closingSituationIndexOffset];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
+ illustrationPointsCategoryName,
+ "Illustratiepunten",
+ "De lijst van illustratiepunten voor de berekening.",
+ true);
+ }
+
+ [Test]
+ public void ToString_CorrectValue_ReturnsCorrectString()
+ {
+ // Setup
+ var faultTreeProperties = new FaultTreeIllustrationPointProperties(
+ new IllustrationPointNode(
+ new TestFaultTreeIllustrationPoint("VeryImportant")),
+ "NotImportant");
+
+ // Call
+ string toString = faultTreeProperties.ToString();
+
+ // Assert
+ Assert.AreEqual("VeryImportant", toString);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -90,10 +90,10 @@
-
-
-
-
+
+
+
+
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeHeightOutputProperties.cs
===================================================================
diff -u -r25872f07e743010d1107ae920e95e0ba1a108cfa -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeHeightOutputProperties.cs (.../DikeHeightOutputProperties.cs) (revision 25872f07e743010d1107ae920e95e0ba1a108cfa)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeHeightOutputProperties.cs (.../DikeHeightOutputProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -180,12 +180,12 @@
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPointProperty_IllustrationPoints_DisplayName))]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPointProperty_IllustrationPoints_Description))]
[TypeConverter(typeof(ExpandableArrayConverter))]
- [KeyValueElement(nameof(FaultTreeIllustrationPointBaseProperties.WindDirection), "")]
- public FaultTreeIllustrationPointBaseProperties[] IllustrationPoints
+ [KeyValueElement(nameof(TopLevelFaultTreeIllustrationPointProperties.WindDirection), "")]
+ public TopLevelFaultTreeIllustrationPointProperties[] IllustrationPoints
{
get
{
- return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new FaultTreeIllustrationPointBaseProperties(point)).ToArray();
+ return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point)).ToArray();
}
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingOutputProperties.cs
===================================================================
diff -u -rf6e0d831deebbd4dea67b34697b64a68d620974d -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingOutputProperties.cs (.../OvertoppingOutputProperties.cs) (revision f6e0d831deebbd4dea67b34697b64a68d620974d)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingOutputProperties.cs (.../OvertoppingOutputProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -187,12 +187,12 @@
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPointProperty_IllustrationPoints_DisplayName))]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPointProperty_IllustrationPoints_Description))]
[TypeConverter(typeof(ExpandableArrayConverter))]
- [KeyValueElement(nameof(FaultTreeIllustrationPointBaseProperties.WindDirection), "")]
- public FaultTreeIllustrationPointBaseProperties[] IllustrationPoints
+ [KeyValueElement(nameof(TopLevelFaultTreeIllustrationPointProperties.WindDirection), "")]
+ public TopLevelFaultTreeIllustrationPointProperties[] IllustrationPoints
{
get
{
- return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new FaultTreeIllustrationPointBaseProperties(point)).ToArray();
+ return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point)).ToArray();
}
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingRateOutputProperties.cs
===================================================================
diff -u -r25872f07e743010d1107ae920e95e0ba1a108cfa -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingRateOutputProperties.cs (.../OvertoppingRateOutputProperties.cs) (revision 25872f07e743010d1107ae920e95e0ba1a108cfa)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingRateOutputProperties.cs (.../OvertoppingRateOutputProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -180,12 +180,12 @@
[ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPointProperty_IllustrationPoints_DisplayName))]
[ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.IllustrationPointProperty_IllustrationPoints_Description))]
[TypeConverter(typeof(ExpandableArrayConverter))]
- [KeyValueElement(nameof(FaultTreeIllustrationPointBaseProperties.WindDirection), "")]
- public FaultTreeIllustrationPointBaseProperties[] IllustrationPoints
+ [KeyValueElement(nameof(TopLevelFaultTreeIllustrationPointProperties.WindDirection), "")]
+ public TopLevelFaultTreeIllustrationPointProperties[] IllustrationPoints
{
get
{
- return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new FaultTreeIllustrationPointBaseProperties(point)).ToArray();
+ return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point)).ToArray();
}
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeHeightOutputPropertiesTest.cs
===================================================================
diff -u -r5856d41b9f384ea1c20a51d637e9d45413df0a4d -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeHeightOutputPropertiesTest.cs (.../DikeHeightOutputPropertiesTest.cs) (revision 5856d41b9f384ea1c20a51d637e9d45413df0a4d)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeHeightOutputPropertiesTest.cs (.../DikeHeightOutputPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -94,15 +94,15 @@
var generalResult = new TestGeneralResultFaultTreeIllustrationPoint();
var expectedFaultTreeIllustrationPointBaseProperty = new[]
{
- new FaultTreeIllustrationPointBaseProperties(generalResult.TopLevelIllustrationPoints.First())
+ new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First())
};
var dikeHeightOutput = new DikeHeightOutput(dikeHeight,
dikeHeightTargetProbability,
dikeHeightTargetReliability,
dikeHeightCalculatedProbability,
dikeHeightCalculatedReliability,
- dikeHeightConvergence,
+ dikeHeightConvergence,
generalResult);
// Call
@@ -272,7 +272,7 @@
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
illustrationPointsCategoryName,
"Illustratiepunten",
- "",
+ "De lijst van illustratiepunten voor de berekening.",
true);
}
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingOutputPropertiesTest.cs
===================================================================
diff -u -rce064290e953de172eb5823ad4caceb0342a0796 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingOutputPropertiesTest.cs (.../OvertoppingOutputPropertiesTest.cs) (revision ce064290e953de172eb5823ad4caceb0342a0796)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingOutputPropertiesTest.cs (.../OvertoppingOutputPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -100,7 +100,7 @@
var generalResult = new TestGeneralResultFaultTreeIllustrationPoint();
var expectedFaultTreeIllustrationPointBaseProperty = new[]
{
- new FaultTreeIllustrationPointBaseProperties(generalResult.TopLevelIllustrationPoints.First())
+ new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First())
};
var overtoppingOutput = new OvertoppingOutput(waveHeight,
@@ -314,7 +314,7 @@
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
illustrationPointsCategoryName,
"Illustratiepunten",
- "",
+ "De lijst van illustratiepunten voor de berekening.",
true);
}
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingRateOutputPropertiesTest.cs
===================================================================
diff -u -r5856d41b9f384ea1c20a51d637e9d45413df0a4d -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingRateOutputPropertiesTest.cs (.../OvertoppingRateOutputPropertiesTest.cs) (revision 5856d41b9f384ea1c20a51d637e9d45413df0a4d)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingRateOutputPropertiesTest.cs (.../OvertoppingRateOutputPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -20,15 +20,13 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Core.Common.Gui.PropertyBag;
using Core.Common.TestUtil;
using Core.Common.Utils;
using NUnit.Framework;
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;
@@ -96,7 +94,7 @@
var generalResult = new TestGeneralResultFaultTreeIllustrationPoint();
var expectedFaultTreeIllustrationPointBaseProperty = new[]
{
- new FaultTreeIllustrationPointBaseProperties(generalResult.TopLevelIllustrationPoints.First())
+ new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First())
};
var overtoppingRateOutput = new OvertoppingRateOutput(overtoppingRate,
@@ -274,7 +272,7 @@
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
illustrationPointsCategoryName,
"Illustratiepunten",
- "",
+ "De lijst van illustratiepunten voor de berekening.",
true);
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r37e22252b83aad49bf849a655c68e1cd22da53f1 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 37e22252b83aad49bf849a655c68e1cd22da53f1)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -330,9 +330,9 @@
CreateInstance = selected => new TopLevelSubMechanismIllustrationPointProperties(selected.TopLevelSubMechanismIllustrationPoint,
selected.ClosingSituations)
};
- yield return new PropertyInfo
+ yield return new PropertyInfo
{
- CreateInstance = point => new FaultTreeIllustrationPointBaseProperties(point)
+ CreateInstance = point => new TopLevelFaultTreeIllustrationPointProperties(point)
};
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs
===================================================================
diff -u -r2ee0d42baed610a91cad9f08a8e7bfa3141e6afd -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs (.../TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs) (revision 2ee0d42baed610a91cad9f08a8e7bfa3141e6afd)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs (.../TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -53,7 +53,7 @@
{
// Assert
Assert.AreEqual(typeof(TopLevelFaultTreeIllustrationPoint), info.DataType);
- Assert.AreEqual(typeof(FaultTreeIllustrationPointBaseProperties), info.PropertyObjectType);
+ Assert.AreEqual(typeof(TopLevelFaultTreeIllustrationPointProperties), info.PropertyObjectType);
}
[Test]
@@ -69,7 +69,7 @@
IObjectProperties objectProperties = info.CreateInstance(topLevelFaultTreeIllustrationPoint);
// Assert
- Assert.IsInstanceOf(objectProperties);
+ Assert.IsInstanceOf(objectProperties);
Assert.AreSame(topLevelFaultTreeIllustrationPoint, objectProperties.Data);
}
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs
===================================================================
diff -u -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 -r3a33e7253e29eb7649dcfc0f675169559b0eefb9
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
@@ -290,7 +290,7 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
typeof(TopLevelFaultTreeIllustrationPoint),
- typeof(FaultTreeIllustrationPointBaseProperties));
+ typeof(TopLevelFaultTreeIllustrationPointProperties));
}
}