Index: Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs
===================================================================
diff -u -rcc883c70ff6e0cf28b0afadae0eccc45163784d1 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs (.../KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs) (revision cc883c70ff6e0cf28b0afadae0eccc45163784d1)
+++ Core/Common/src/Core.Common.Gui/Converters/KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs (.../KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -66,7 +66,7 @@
}
var doubleValue = (RoundedDouble) valueProperty;
- return doubleValue.ToString("0.#####", CultureInfo.GetCultureInfo("nl-NL"));
+ return doubleValue.ToString("0.#####", CultureInfo.CurrentCulture);
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/SelectedTopLevelFaultTreeIllustrationPoint.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/SelectedTopLevelFaultTreeIllustrationPoint.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/SelectedTopLevelFaultTreeIllustrationPoint.cs (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -0,0 +1,66 @@
+// 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 Ringtoets.Common.Data.IllustrationPoints;
+
+namespace Ringtoets.Common.Forms.PresentationObjects
+{
+ ///
+ /// Class that represents a top level sub mechanism illustration point together
+ /// with all the calculated closing situations that are present.
+ ///
+ public class SelectedTopLevelFaultTreeIllustrationPoint
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The top level sub mechanism illustration point.
+ /// The closing situations that are present.
+ /// Thrown when any parameter is null.
+ public SelectedTopLevelFaultTreeIllustrationPoint(TopLevelFaultTreeIllustrationPoint topLevelFaultTreeIllustrationPoint,
+ IEnumerable closingSituations)
+ {
+ if (topLevelFaultTreeIllustrationPoint == null)
+ {
+ throw new ArgumentNullException(nameof(topLevelFaultTreeIllustrationPoint));
+ }
+ if (closingSituations == null)
+ {
+ throw new ArgumentNullException(nameof(closingSituations));
+ }
+
+ TopLevelFaultTreeIllustrationPoint = topLevelFaultTreeIllustrationPoint;
+ ClosingSituations = closingSituations;
+ }
+
+ ///
+ /// Gets the top level fault tree illustration point.
+ ///
+ public TopLevelFaultTreeIllustrationPoint TopLevelFaultTreeIllustrationPoint { get; }
+
+ ///
+ /// Gets the calculated closing situations.
+ ///
+ public IEnumerable ClosingSituations { get; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresOutputProperties.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresOutputProperties.cs (.../StructuresOutputProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresOutputProperties.cs (.../StructuresOutputProperties.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -108,7 +108,7 @@
List listOfClosingSituations = data.GeneralResult.TopLevelIllustrationPoints.Select(topLevelFaultTreeIllustrationPoint =>
topLevelFaultTreeIllustrationPoint.ClosingSituation).ToList();
- return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point, listOfClosingSituations.Distinct().Count() > 1)).ToArray();
+ return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point, listOfClosingSituations)).ToArray();
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelFaultTreeIllustrationPointProperties.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelFaultTreeIllustrationPointProperties.cs (.../TopLevelFaultTreeIllustrationPointProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TopLevelFaultTreeIllustrationPointProperties.cs (.../TopLevelFaultTreeIllustrationPointProperties.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -41,28 +41,33 @@
[TypeConverter(typeof(ExpandableObjectConverter))]
public class TopLevelFaultTreeIllustrationPointProperties : ObjectProperties
{
- private readonly bool showClosingSituation;
+ private readonly IEnumerable closingSituations;
///
/// Creates a new instance of .
///
/// The data to use for the properties.
+ /// All closing situations in the tree
/// Thrown when any input parameter is null.
public TopLevelFaultTreeIllustrationPointProperties(
- TopLevelFaultTreeIllustrationPoint faultTreeData, bool hasUniqueClosingSituations = false)
+ TopLevelFaultTreeIllustrationPoint faultTreeData, IEnumerable allClosingSituations)
{
if (faultTreeData == null)
{
throw new ArgumentNullException(nameof(faultTreeData));
}
+ if (allClosingSituations == null)
+ {
+ throw new ArgumentNullException(nameof(allClosingSituations));
+ }
data = faultTreeData;
- showClosingSituation = hasUniqueClosingSituations;
+ closingSituations = allClosingSituations;
}
- [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))]
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
public double CalculatedProbability
{
get
@@ -71,10 +76,10 @@
}
}
- [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))]
+ [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
public RoundedDouble Reliability
{
get
@@ -165,7 +170,12 @@
[DynamicVisibleValidationMethod]
public bool DynamicVisibleValidationMethod(string propertyName)
{
- return propertyName.Equals(nameof(ClosingSituation)) && showClosingSituation;
+ if (propertyName == nameof(ClosingSituation))
+ {
+ return !(closingSituations.Distinct().Count() < 2);
+ }
+
+ return false;
}
public override string ToString()
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -74,6 +74,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/GeneralResultFaultTreeIllustrationPointView.cs
===================================================================
diff -u -rb682197e586584cc5f29fafe31d6ed185b55e1e7 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/GeneralResultFaultTreeIllustrationPointView.cs (.../GeneralResultFaultTreeIllustrationPointView.cs) (revision b682197e586584cc5f29fafe31d6ed185b55e1e7)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/GeneralResultFaultTreeIllustrationPointView.cs (.../GeneralResultFaultTreeIllustrationPointView.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -27,6 +27,7 @@
using Core.Common.Controls.Views;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Forms.PresentationObjects;
namespace Ringtoets.Common.Forms.Views
{
@@ -139,7 +140,11 @@
private void OnIllustrationPointsControlSelectionChanged(object sender, EventArgs e)
{
- Selection = (illustrationPointsControl.Selection as IllustrationPointControlItem)?.Source;
+ var selection = illustrationPointsControl.Selection as IllustrationPointControlItem;
+ Selection = selection != null
+ ? new SelectedTopLevelFaultTreeIllustrationPoint((TopLevelFaultTreeIllustrationPoint)selection.Source,
+ GetIllustrationPointControlItems().Select(ipci => ipci.ClosingSituation))
+ : null;
OnSelectionChanged();
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/SelectedTopLevelFaultTreeIllustrationPointTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/SelectedTopLevelFaultTreeIllustrationPointTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/SelectedTopLevelFaultTreeIllustrationPointTest.cs (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -0,0 +1,82 @@
+// 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.Linq;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PresentationObjects;
+
+namespace Ringtoets.Common.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class SelectedTopLevelFaultTreeIllustrationPointTest
+ {
+ [Test]
+ public void Constructor_TopLevelFaultTreeIllustrationPointNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new SelectedTopLevelFaultTreeIllustrationPoint(null,
+ Enumerable.Empty());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("topLevelFaultTreeIllustrationPoint", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ClosingSituationsNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new SelectedTopLevelFaultTreeIllustrationPoint(CreateTopLevelSubMechanismIllustrationPoint(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("closingSituations", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ValidArguments_ReturnsExpectedValues()
+ {
+ // Setup
+ TopLevelFaultTreeIllustrationPoint topLevelFaultTreeIllustrationPoint = CreateTopLevelSubMechanismIllustrationPoint();
+ IEnumerable closingSituations = Enumerable.Empty();
+
+ // Call
+ var selectedTopLevelFaultTreeIllustrationPoint = new SelectedTopLevelFaultTreeIllustrationPoint(topLevelFaultTreeIllustrationPoint,
+ closingSituations);
+
+ // Assert
+ Assert.AreSame(topLevelFaultTreeIllustrationPoint, selectedTopLevelFaultTreeIllustrationPoint.TopLevelFaultTreeIllustrationPoint);
+ Assert.AreSame(closingSituations, selectedTopLevelFaultTreeIllustrationPoint.ClosingSituations);
+ }
+
+ private static TopLevelFaultTreeIllustrationPoint CreateTopLevelSubMechanismIllustrationPoint()
+ {
+ return new TopLevelFaultTreeIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(),
+ "Closing situation",
+ new IllustrationPointNode(new TestIllustrationPoint()));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointPropertiesTest.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointPropertiesTest.cs (.../IllustrationPointPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointPropertiesTest.cs (.../IllustrationPointPropertiesTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -21,12 +21,14 @@
using System;
using System.ComponentModel;
+using Core.Common.Gui.Converters;
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;
+using Ringtoets.Common.Forms.TypeConverters;
namespace Ringtoets.Common.Forms.Test.PropertyClasses
{
@@ -65,11 +67,19 @@
// Assert
Assert.AreEqual("NNE", faultTree.WindDirection);
+
+ TestHelper.AssertTypeConverter(
+ nameof(IllustrationPointProperties.Reliability));
Assert.AreEqual(3.14, faultTree.Reliability.Value);
+
+ TestHelper.AssertTypeConverter(
+ nameof(IllustrationPointProperties.CalculatedProbability));
Assert.AreEqual(5, faultTree.Reliability.NumberOfDecimalPlaces);
Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), faultTree.CalculatedProbability);
Assert.AreEqual("Illustration Point", faultTree.Name);
+ TestHelper.AssertTypeConverter(
+ nameof(IllustrationPointProperties.IllustrationPoints));
Assert.IsNotNull(faultTree.IllustrationPoints);
Assert.AreEqual(0, faultTree.IllustrationPoints.Length);
}
@@ -90,11 +100,19 @@
// Assert
Assert.AreEqual("N", faultTree.WindDirection);
+
+ TestHelper.AssertTypeConverter(
+ nameof(IllustrationPointProperties.Reliability));
Assert.AreEqual(3.14, faultTree.Reliability.Value);
+
+ TestHelper.AssertTypeConverter(
+ nameof(IllustrationPointProperties.CalculatedProbability));
Assert.AreEqual(5, faultTree.Reliability.NumberOfDecimalPlaces);
Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), faultTree.CalculatedProbability);
Assert.AreEqual("Illustration Point", faultTree.Name);
+ TestHelper.AssertTypeConverter(
+ nameof(IllustrationPointProperties.IllustrationPoints));
Assert.IsNotNull(faultTree.IllustrationPoints);
Assert.AreEqual(2, faultTree.IllustrationPoints.Length);
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresOutputPropertiesTest.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresOutputPropertiesTest.cs (.../StructuresOutputPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresOutputPropertiesTest.cs (.../StructuresOutputPropertiesTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -22,6 +22,7 @@
using System;
using System.ComponentModel;
using System.Linq;
+using Core.Common.Gui.Converters;
using Core.Common.Gui.PropertyBag;
using Core.Common.TestUtil;
using NUnit.Framework;
@@ -107,20 +108,30 @@
var properties = new StructuresOutputProperties(structuresOutput);
// Assert
- var expectedFaultTreeIllustrationPointBaseProperty = new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First());
+ var expectedFaultTreeIllustrationPointBaseProperty = new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First(), new [] {"closing situation"});
Assert.AreEqual(ProbabilityFormattingHelper.Format(requiredProbability), properties.RequiredProbability);
Assert.AreEqual(requiredReliability, properties.RequiredReliability, properties.RequiredReliability.GetAccuracy());
Assert.AreEqual(ProbabilityFormattingHelper.Format(probability), properties.Probability);
Assert.AreEqual(reliability, properties.Reliability, properties.Reliability.GetAccuracy());
Assert.AreEqual(factorOfSafety, properties.FactorOfSafety, properties.FactorOfSafety.GetAccuracy());
Assert.AreEqual(generalResult.GoverningWindDirection.Name, properties.WindDirection);
+
+ TestHelper.AssertTypeConverter(
+ nameof(StructuresOutputProperties.AlphaValues));
Assert.AreEqual(5.0, properties.AlphaValues[0].Alpha);
+
+ TestHelper.AssertTypeConverter(
+ nameof(StructuresOutputProperties.Durations));
Assert.AreEqual(10.0, properties.Durations[0].Duration);
+
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);
+
+ TestHelper.AssertTypeConverter(
+ nameof(StructuresOutputProperties.IllustrationPoints));
Assert.AreEqual(expectedFaultTreeIllustrationPointBaseProperty.IllustrationPoints, properties.IllustrationPoints[0].IllustrationPoints);
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (.../SubMechanismIllustrationPointPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (.../SubMechanismIllustrationPointPropertiesTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -22,12 +22,14 @@
using System;
using System.ComponentModel;
using System.Linq;
+using Core.Common.Gui.Converters;
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;
+using Ringtoets.Common.Forms.TypeConverters;
namespace Ringtoets.Common.Forms.Test.PropertyClasses
{
@@ -70,23 +72,37 @@
// Assert
Assert.AreEqual("N", subMechanismProperties.WindDirection);
+
+ TestHelper.AssertTypeConverter(
+ nameof(SubMechanismIllustrationPointProperties.Reliability));
Assert.AreEqual(3.14, subMechanismProperties.Reliability.Value);
Assert.AreEqual(5, subMechanismProperties.Reliability.NumberOfDecimalPlaces);
+
+ TestHelper.AssertTypeConverter(
+ nameof(SubMechanismIllustrationPointProperties.CalculatedProbability));
Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), subMechanismProperties.CalculatedProbability);
Assert.AreEqual("Illustration Point", subMechanismProperties.Name);
+ TestHelper.AssertTypeConverter(
+ nameof(SubMechanismIllustrationPointProperties.AlphaValues));
Assert.IsNotEmpty(subMechanismProperties.AlphaValues);
Assert.AreEqual(1, subMechanismProperties.AlphaValues.Length);
Assert.AreEqual(4.5, subMechanismProperties.AlphaValues.First().Alpha);
+ TestHelper.AssertTypeConverter(
+ nameof(SubMechanismIllustrationPointProperties.Durations));
Assert.IsNotEmpty(subMechanismProperties.Durations);
Assert.AreEqual(1, subMechanismProperties.Durations.Length);
Assert.AreEqual(2.0, subMechanismProperties.Durations.First().Duration);
+ TestHelper.AssertTypeConverter(
+ nameof(SubMechanismIllustrationPointProperties.SubMechanismStochasts));
Assert.IsNotEmpty(subMechanismProperties.SubMechanismStochasts);
Assert.AreEqual(1, subMechanismProperties.SubMechanismStochasts.Length);
Assert.AreEqual(0.1, subMechanismProperties.SubMechanismStochasts.First().Realization);
+ TestHelper.AssertTypeConverter(
+ nameof(SubMechanismIllustrationPointProperties.IllustrationPoints));
Assert.IsEmpty(subMechanismProperties.IllustrationPoints);
Assert.AreEqual(0, subMechanismProperties.IllustrationPoints.Length);
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelFaultTreeIllustrationPointPropertiesTest.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelFaultTreeIllustrationPointPropertiesTest.cs (.../TopLevelFaultTreeIllustrationPointPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelFaultTreeIllustrationPointPropertiesTest.cs (.../TopLevelFaultTreeIllustrationPointPropertiesTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -21,30 +21,60 @@
using System;
using System.ComponentModel;
+using Core.Common.Gui.Converters;
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;
+using Ringtoets.Common.Forms.TypeConverters;
namespace Ringtoets.Common.Forms.Test.PropertyClasses
{
[TestFixture]
public class TopLevelFaultTreeIllustrationPointPropertiesTest
{
+ private const int probabilityPropertyIndex = 0;
+ private const int reliabilityPropertyIndex = 1;
+ private const int windDirectionPropertyIndex = 2;
+ private const int closingSituationPropertyIndex = 3;
+ private const int alphasPropertyIndex = 4;
+ private const int durationsPropertyIndex = 5;
+ private const int illustrationPointPropertyIndex = 6;
+
[Test]
- public void Constructor_Null_ThrowsException()
+ public void Constructor_FaultTreeNull_ThrowsException()
{
// Call
- TestDelegate test = () => new TopLevelFaultTreeIllustrationPointProperties(null);
+ TestDelegate test = () => new TopLevelFaultTreeIllustrationPointProperties(null, new[]
+ {
+ "closing situation"
+ });
// Assert
const string expectedMessage = "Value cannot be null.";
TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
}
[Test]
+ public void Constructor_ClosingSituationsNull_ThrowsException()
+ {
+ // Setup
+ var topLevel = new TopLevelFaultTreeIllustrationPoint(
+ new WindDirection("N", 5.0),
+ "closing situation",
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint()));
+
+ // Call
+ TestDelegate test = () => new TopLevelFaultTreeIllustrationPointProperties(topLevel, null);
+
+ // Assert
+ const string expectedMessage = "Value cannot be null.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
public void Constructor_FaultTreeIllustrationPoint_CorrectValues()
{
// Setup
@@ -59,35 +89,49 @@
topLevel.FaultTreeNodeRoot.SetChildren(new[]
{
new IllustrationPointNode(new TestFaultTreeIllustrationPoint()),
- new IllustrationPointNode(new TestFaultTreeIllustrationPoint())
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint())
});
// Call
- var faultTree = new TopLevelFaultTreeIllustrationPointProperties(topLevel);
+ var faultTree = new TopLevelFaultTreeIllustrationPointProperties(topLevel, new[]
+ {
+ "closing situation"
+ });
// Assert
Assert.AreEqual("N", faultTree.WindDirection);
+
+ TestHelper.AssertTypeConverter(
+ nameof(TopLevelFaultTreeIllustrationPointProperties.Reliability));
Assert.AreEqual(3.14, faultTree.Reliability.Value);
Assert.AreEqual(5, faultTree.Reliability.NumberOfDecimalPlaces);
+
+ TestHelper.AssertTypeConverter(
+ nameof(TopLevelFaultTreeIllustrationPointProperties.CalculatedProbability));
Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), faultTree.CalculatedProbability);
+
Assert.AreEqual("closing situation", faultTree.ClosingSituation);
+ TestHelper.AssertTypeConverter(
+ nameof(TopLevelFaultTreeIllustrationPointProperties.AlphaValues));
Assert.IsNotNull(faultTree.AlphaValues);
Assert.AreEqual(1, faultTree.AlphaValues.Length);
Assert.AreEqual(5.5, faultTree.AlphaValues[0].Alpha);
+ TestHelper.AssertTypeConverter(
+ nameof(TopLevelFaultTreeIllustrationPointProperties.Durations));
Assert.IsNotNull(faultTree.Durations);
Assert.AreEqual(1, faultTree.Durations.Length);
Assert.AreEqual(2.5, faultTree.Durations[0].Duration);
+ TestHelper.AssertTypeConverter(
+ nameof(TopLevelFaultTreeIllustrationPointProperties.IllustrationPoints));
Assert.IsNotNull(faultTree.IllustrationPoints);
Assert.AreEqual(2, faultTree.IllustrationPoints.Length);
}
[Test]
- [TestCase(true)]
- [TestCase(false)]
- public void Constructor_Always_PropertiesHaveExpectedAttributesValues(bool showClosingSituations)
+ public void Constructor_NoUniqueClosingSituations_PropertiesHaveExpectedAttributesValues()
{
// Setup
var topLevel = new TopLevelFaultTreeIllustrationPoint(
@@ -96,61 +140,125 @@
new IllustrationPointNode(new TestFaultTreeIllustrationPoint()));
// Call
- var topLevelFaultTree = new TopLevelFaultTreeIllustrationPointProperties(topLevel, showClosingSituations);
+ var topLevelFaultTree = new TopLevelFaultTreeIllustrationPointProperties(topLevel, new[]
+ {
+ "closing situation"
+ });
// Assert
const string illustrationPointsCategoryName = "Illustratiepunten";
- int closingSituationIndexOffset = showClosingSituations ? 1 : 0;
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(topLevelFaultTree);
- Assert.AreEqual(6 + closingSituationIndexOffset, dynamicProperties.Count);
+ Assert.AreEqual(6, dynamicProperties.Count);
- PropertyDescriptor probabilityProperty = dynamicProperties[0];
+ 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[1];
+ 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[2];
+ PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
illustrationPointsCategoryName,
"Windrichting",
"De windrichting waarvoor dit illlustratiepunt is berekend.",
true);
- if (showClosingSituations)
+ PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex - 1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty,
+ illustrationPointsCategoryName,
+ "Alfa's [-]",
+ "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.",
+ true);
+
+ PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex - 1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
+ illustrationPointsCategoryName,
+ "Tijdsduren [min]",
+ "Tijdsduren waarop de stochasten betrekking hebben.",
+ true);
+
+ PropertyDescriptor illustrationPointProperty = dynamicProperties[illustrationPointPropertyIndex - 1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
+ illustrationPointsCategoryName,
+ "Illustratiepunten",
+ "De lijst van illustratiepunten voor de berekening.",
+ true);
+ }
+
+ [Test]
+ public void Constructor_UniqueClosingSituations_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var topLevel = new TopLevelFaultTreeIllustrationPoint(
+ new WindDirection("N", 5.0),
+ "closing situation",
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint()));
+
+ // Call
+ var topLevelFaultTree = new TopLevelFaultTreeIllustrationPointProperties(topLevel, new[]
{
- PropertyDescriptor closingSituationProperty = dynamicProperties[3];
- PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingSituationProperty,
- illustrationPointsCategoryName,
- "Sluitscenario",
- "Het sluitscenario waarvoor dit illustratiepunt is berekend.",
- true);
- }
+ "closing situation",
+ "closing situation 2"
+ });
- PropertyDescriptor alphasProperty = dynamicProperties[3 + closingSituationIndexOffset];
+ // Assert
+ const string illustrationPointsCategoryName = "Illustratiepunten";
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(topLevelFaultTree);
+ 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 closingSituationProperty = dynamicProperties[closingSituationPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingSituationProperty,
+ 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[4 + closingSituationIndexOffset];
+ PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty,
illustrationPointsCategoryName,
"Tijdsduren [min]",
"Tijdsduren waarop de stochasten betrekking hebben.",
true);
- PropertyDescriptor illustrationPointProperty = dynamicProperties[5 + closingSituationIndexOffset];
+ PropertyDescriptor illustrationPointProperty = dynamicProperties[illustrationPointPropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
illustrationPointsCategoryName,
"Illustratiepunten",
@@ -162,16 +270,21 @@
public void ToString_CorrectValue_ReturnsCorrectString()
{
// Setup
- var faultTreeProperties = new FaultTreeIllustrationPointProperties(
- new IllustrationPointNode(
- new TestFaultTreeIllustrationPoint("VeryImportant")),
- "NotImportant");
+ var topLevelFaultTreeIllustrationPoint = new TopLevelFaultTreeIllustrationPoint(
+ new WindDirection("N", 5.0),
+ "closing situation",
+ new IllustrationPointNode(new TestFaultTreeIllustrationPoint()));
+ var topLevelFaultTreeProperties = new TopLevelFaultTreeIllustrationPointProperties(topLevelFaultTreeIllustrationPoint, new[]
+ {
+ "closing situation"
+ });
+
// Call
- string toString = faultTreeProperties.ToString();
+ string toString = topLevelFaultTreeProperties.ToString();
// Assert
- Assert.AreEqual("VeryImportant", toString);
+ Assert.AreEqual("N", toString);
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -86,6 +86,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs
===================================================================
diff -u -r88c078b4ce562509a08e6fb962adb8e773f080a7 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs (.../GeneralResultFaultTreeIllustrationPointViewTest.cs) (revision 88c078b4ce562509a08e6fb962adb8e773f080a7)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs (.../GeneralResultFaultTreeIllustrationPointViewTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -31,6 +31,7 @@
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.IllustrationPoints;
using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Common.Forms.Views;
@@ -288,7 +289,7 @@
// Then
Assert.AreNotEqual(0, selectionChangedCount);
- Assert.AreSame(generalResult.TopLevelIllustrationPoints.ElementAt(0), view.Selection);
+ Assert.AreSame(generalResult.TopLevelIllustrationPoints.ElementAt(0), ((SelectedTopLevelFaultTreeIllustrationPoint)view.Selection).TopLevelFaultTreeIllustrationPoint);
mocks.VerifyAll();
}
@@ -351,7 +352,7 @@
// Then
Assert.AreEqual(1, selectionChangedCount);
- Assert.AreSame(generalResult.TopLevelIllustrationPoints.ElementAt(1), view.Selection);
+ Assert.AreSame(generalResult.TopLevelIllustrationPoints.ElementAt(1), ((SelectedTopLevelFaultTreeIllustrationPoint) view.Selection).TopLevelFaultTreeIllustrationPoint);
mocks.VerifyAll();
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeHeightOutputProperties.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeHeightOutputProperties.cs (.../DikeHeightOutputProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeHeightOutputProperties.cs (.../DikeHeightOutputProperties.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Core.Common.Base.Data;
@@ -185,7 +186,10 @@
{
get
{
- return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point)).ToArray();
+ List listOfClosingSituations = data.GeneralResult.TopLevelIllustrationPoints.Select(topLevelFaultTreeIllustrationPoint =>
+ topLevelFaultTreeIllustrationPoint.ClosingSituation).ToList();
+
+ return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point, listOfClosingSituations)).ToArray();
}
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingOutputProperties.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingOutputProperties.cs (.../OvertoppingOutputProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingOutputProperties.cs (.../OvertoppingOutputProperties.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Core.Common.Base.Data;
@@ -192,7 +193,10 @@
{
get
{
- return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point)).ToArray();
+ List listOfClosingSituations = data.GeneralResult.TopLevelIllustrationPoints.Select(topLevelFaultTreeIllustrationPoint =>
+ topLevelFaultTreeIllustrationPoint.ClosingSituation).ToList();
+
+ return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point, listOfClosingSituations)).ToArray();
}
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingRateOutputProperties.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingRateOutputProperties.cs (.../OvertoppingRateOutputProperties.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/OvertoppingRateOutputProperties.cs (.../OvertoppingRateOutputProperties.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Core.Common.Base.Data;
@@ -185,7 +186,10 @@
{
get
{
- return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point)).ToArray();
+ List listOfClosingSituations = data.GeneralResult.TopLevelIllustrationPoints.Select(topLevelFaultTreeIllustrationPoint =>
+ topLevelFaultTreeIllustrationPoint.ClosingSituation).ToList();
+
+ return data.GeneralResult.TopLevelIllustrationPoints.Select(point => new TopLevelFaultTreeIllustrationPointProperties(point, listOfClosingSituations)).ToArray();
}
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeHeightOutputPropertiesTest.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeHeightOutputPropertiesTest.cs (.../DikeHeightOutputPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeHeightOutputPropertiesTest.cs (.../DikeHeightOutputPropertiesTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -94,7 +94,10 @@
var generalResult = new TestGeneralResultFaultTreeIllustrationPoint();
var expectedFaultTreeIllustrationPointBaseProperty = new[]
{
- new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First())
+ new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First(), new[]
+ {
+ "closing situation"
+ })
};
var dikeHeightOutput = new DikeHeightOutput(dikeHeight,
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingOutputPropertiesTest.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingOutputPropertiesTest.cs (.../OvertoppingOutputPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingOutputPropertiesTest.cs (.../OvertoppingOutputPropertiesTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -100,7 +100,10 @@
var generalResult = new TestGeneralResultFaultTreeIllustrationPoint();
var expectedFaultTreeIllustrationPointBaseProperty = new[]
{
- new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First())
+ new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First(), new[]
+ {
+ "closing situation"
+ })
};
var overtoppingOutput = new OvertoppingOutput(waveHeight,
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingRateOutputPropertiesTest.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingRateOutputPropertiesTest.cs (.../OvertoppingRateOutputPropertiesTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/OvertoppingRateOutputPropertiesTest.cs (.../OvertoppingRateOutputPropertiesTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -94,7 +94,10 @@
var generalResult = new TestGeneralResultFaultTreeIllustrationPoint();
var expectedFaultTreeIllustrationPointBaseProperty = new[]
{
- new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First())
+ new TopLevelFaultTreeIllustrationPointProperties(generalResult.TopLevelIllustrationPoints.First(), new[]
+ {
+ "closing situation"
+ })
};
var overtoppingRateOutput = new OvertoppingRateOutput(overtoppingRate,
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -48,7 +48,6 @@
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.Hydraulics;
-using Ringtoets.Common.Data.IllustrationPoints;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Forms.ChangeHandlers;
using Ringtoets.Common.Forms.GuiServices;
@@ -330,9 +329,10 @@
CreateInstance = selected => new TopLevelSubMechanismIllustrationPointProperties(selected.TopLevelSubMechanismIllustrationPoint,
selected.ClosingSituations)
};
- yield return new PropertyInfo
+ yield return new PropertyInfo
{
- CreateInstance = point => new TopLevelFaultTreeIllustrationPointProperties(point)
+ CreateInstance = point => new TopLevelFaultTreeIllustrationPointProperties(point.TopLevelFaultTreeIllustrationPoint,
+ point.ClosingSituations)
};
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/SelectedTopLevelFaultTreeIllustrationPointPropertyInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/SelectedTopLevelFaultTreeIllustrationPointPropertyInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/SelectedTopLevelFaultTreeIllustrationPointPropertyInfoTest.cs (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -0,0 +1,80 @@
+// 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.Linq;
+using Core.Common.Gui.Plugin;
+using Core.Common.Gui.PropertyBag;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Common.Forms.PropertyClasses;
+
+namespace Ringtoets.Integration.Plugin.Test.PropertyInfos
+{
+ [TestFixture]
+ public class SelectedTopLevelFaultTreeIllustrationPointPropertyInfoTest
+ {
+ private RingtoetsPlugin plugin;
+ private PropertyInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new RingtoetsPlugin();
+ info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(TopLevelFaultTreeIllustrationPointProperties));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(SelectedTopLevelFaultTreeIllustrationPoint), info.DataType);
+ Assert.AreEqual(typeof(TopLevelFaultTreeIllustrationPointProperties), info.PropertyObjectType);
+ }
+
+ [Test]
+ public void CreateInstance_TopLevelFaultTreeIllustrationPoint_ReturnFaultTreeIllustrationPointBaseProperties()
+ {
+ // Setup
+ var topLevelFaultTreeIllustrationPoint = new TopLevelFaultTreeIllustrationPoint(
+ WindDirectionTestFactory.CreateTestWindDirection(),
+ "Closing situation",
+ new IllustrationPointNode(new TestIllustrationPoint()));
+
+ var selectedTopLevelFaultTreeIllustrationPoint = new SelectedTopLevelFaultTreeIllustrationPoint(topLevelFaultTreeIllustrationPoint,
+ Enumerable.Empty());
+
+ // Call
+ IObjectProperties objectProperties = info.CreateInstance(selectedTopLevelFaultTreeIllustrationPoint);
+
+ // Assert
+ Assert.IsInstanceOf(selectedTopLevelFaultTreeIllustrationPoint);
+ Assert.AreSame(topLevelFaultTreeIllustrationPoint, objectProperties.Data);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag c072c430cf3193c3ada31a81bd0cd4e75f4a068a refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/TopLevelFaultTreeIllustrationPointPropertyInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -rd6f67b18eba9be133de89079e68794b319c16233 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision d6f67b18eba9be133de89079e68794b319c16233)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -87,7 +87,7 @@
-
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs
===================================================================
diff -u -r3a33e7253e29eb7649dcfc0f675169559b0eefb9 -rc072c430cf3193c3ada31a81bd0cd4e75f4a068a
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 3a33e7253e29eb7649dcfc0f675169559b0eefb9)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision c072c430cf3193c3ada31a81bd0cd4e75f4a068a)
@@ -289,7 +289,7 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
- typeof(TopLevelFaultTreeIllustrationPoint),
+ typeof(SelectedTopLevelFaultTreeIllustrationPoint),
typeof(TopLevelFaultTreeIllustrationPointProperties));
}
}