Fisheye: Tag cf89119fc5a8184e0cbb07ec916d7b17c2e93a05 refers to a dead (removed) revision in file `Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PropertyClasses/ClosingStructuresFailureMechanismProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PropertyClasses/ClosingStructuresFailurePathProperties.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PropertyClasses/ClosingStructuresFailurePathProperties.cs (revision 0)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PropertyClasses/ClosingStructuresFailurePathProperties.cs (revision d480fcf3bc481eecc0568ee40d2dfa808505f8c2)
@@ -0,0 +1,59 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 Riskeer.ClosingStructures.Data;
+using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
+
+namespace Riskeer.ClosingStructures.Forms.PropertyClasses
+{
+ ///
+ /// Failure path related ViewModel of for properties panel.
+ ///
+ public class ClosingStructuresFailurePathProperties : ClosingStructuresFailureMechanismProperties
+ {
+ private const int namePropertyIndex = 1;
+ private const int codePropertyIndex = 2;
+ private const int groupPropertyIndex = 3;
+ private const int contributionPropertyIndex = 4;
+
+ private const int cPropertyIndex = 5;
+ private const int n2APropertyIndex = 6;
+ private const int nPropertyIndex = 7;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The instance to show the properties of.
+ /// Thrown when
+ /// is null.
+ public ClosingStructuresFailurePathProperties(ClosingStructuresFailureMechanism data) : base(data, new ConstructionProperties
+ {
+ NamePropertyIndex = namePropertyIndex,
+ CodePropertyIndex = codePropertyIndex,
+ GroupPropertyIndex = groupPropertyIndex,
+ ContributionPropertyIndex = contributionPropertyIndex,
+ CPropertyIndex = cPropertyIndex,
+ N2APropertyIndex = n2APropertyIndex,
+ NPropertyIndex = nPropertyIndex
+ }) {}
+ }
+}
\ No newline at end of file
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs
===================================================================
diff -u -rcf89119fc5a8184e0cbb07ec916d7b17c2e93a05 -rd480fcf3bc481eecc0568ee40d2dfa808505f8c2
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision cf89119fc5a8184e0cbb07ec916d7b17c2e93a05)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision d480fcf3bc481eecc0568ee40d2dfa808505f8c2)
@@ -73,6 +73,10 @@
{
CreateInstance = context => new ClosingStructuresCalculationsProperties(context.WrappedData)
};
+ yield return new PropertyInfo
+ {
+ CreateInstance = context => new ClosingStructuresFailurePathProperties(context.WrappedData)
+ };
yield return new PropertyInfo();
yield return new PropertyInfo>
{
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresCalculationsPropertiesTest.cs
===================================================================
diff -u -rc9dabbc8879e7f6e78ba4e514291d79a078b2916 -rd480fcf3bc481eecc0568ee40d2dfa808505f8c2
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresCalculationsPropertiesTest.cs (.../ClosingStructuresCalculationsPropertiesTest.cs) (revision c9dabbc8879e7f6e78ba4e514291d79a078b2916)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresCalculationsPropertiesTest.cs (.../ClosingStructuresCalculationsPropertiesTest.cs) (revision d480fcf3bc481eecc0568ee40d2dfa808505f8c2)
@@ -23,7 +23,6 @@
using System.ComponentModel;
using Core.Common.Base;
using Core.Common.TestUtil;
-using Core.Gui.PropertyBag;
using Core.Gui.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
@@ -72,7 +71,7 @@
var properties = new ClosingStructuresCalculationsProperties(failureMechanism);
// Assert
- Assert.IsInstanceOf>(properties);
+ Assert.IsInstanceOf(properties);
Assert.AreSame(failureMechanism, properties.Data);
Assert.AreEqual(failureMechanism.Name, properties.Name);
Assert.AreEqual(failureMechanism.Code, properties.Code);
Fisheye: Tag cf89119fc5a8184e0cbb07ec916d7b17c2e93a05 refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailureMechanismPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailurePathPropertiesTest.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailurePathPropertiesTest.cs (revision 0)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailurePathPropertiesTest.cs (revision d480fcf3bc481eecc0568ee40d2dfa808505f8c2)
@@ -0,0 +1,179 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Base;
+using Core.Common.TestUtil;
+using Core.Gui.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.ClosingStructures.Forms.PropertyClasses;
+using Riskeer.Common.Data.TestUtil;
+
+namespace Riskeer.ClosingStructures.Forms.Test.PropertyClasses
+{
+ public class ClosingStructuresFailurePathPropertiesTest
+ {
+ private const int namePropertyIndex = 0;
+ private const int codePropertyIndex = 1;
+ private const int groupPropertyIndex = 2;
+ private const int contributionPropertyIndex = 3;
+ private const int cPropertyIndex = 4;
+ private const int n2APropertyIndex = 5;
+ private const int nPropertyIndex = 6;
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ // Call
+ var properties = new ClosingStructuresFailurePathProperties(failureMechanism);
+
+ // Assert
+ Assert.IsInstanceOf(properties);
+ Assert.AreSame(failureMechanism, properties.Data);
+ Assert.AreEqual(failureMechanism.Name, properties.Name);
+ Assert.AreEqual(failureMechanism.Code, properties.Code);
+ Assert.AreEqual(failureMechanism.Group, properties.Group);
+ Assert.AreEqual(failureMechanism.Contribution, properties.Contribution);
+
+ GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput;
+
+ Assert.AreEqual(generalInput.C, properties.C);
+ Assert.AreEqual(generalInput.N2A, properties.N2A);
+ Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
+ Assert.AreEqual(generalInput.N, properties.N, properties.N.GetAccuracy());
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributeValues()
+ {
+ // Call
+ var properties = new ClosingStructuresFailurePathProperties(new ClosingStructuresFailureMechanism());
+
+ // Assert
+ const string generalCategory = "Algemeen";
+ const string lengthEffectCategory = "Lengte-effect parameters";
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(7, dynamicProperties.Count);
+
+ PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "De naam van het toetsspoor.",
+ true);
+
+ PropertyDescriptor codeProperty = dynamicProperties[codePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(codeProperty,
+ generalCategory,
+ "Label",
+ "Het label van het toetsspoor.",
+ true);
+
+ PropertyDescriptor groupProperty = dynamicProperties[groupPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(groupProperty,
+ generalCategory,
+ "Groep",
+ "De groep waar het toetsspoor toe behoort.",
+ true);
+
+ PropertyDescriptor contributionProperty = dynamicProperties[contributionPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(contributionProperty,
+ generalCategory,
+ "Faalkansbijdrage [%]",
+ "Procentuele bijdrage van dit toetsspoor aan de totale overstromingskans van het traject.",
+ true);
+
+ PropertyDescriptor cProperty = dynamicProperties[cPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(cProperty,
+ lengthEffectCategory,
+ "C [-]",
+ "De parameter 'C' die gebruikt wordt om het lengte-effect te berekenen.",
+ true);
+
+ PropertyDescriptor n2AProperty = dynamicProperties[n2APropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(n2AProperty,
+ lengthEffectCategory,
+ "2NA [-]",
+ "De parameter '2NA' die gebruikt wordt om het lengte-effect te berekenen.");
+
+ PropertyDescriptor nProperty = dynamicProperties[nPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nProperty,
+ lengthEffectCategory,
+ "N* [-]",
+ "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling (afgerond).",
+ true);
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ [TestCase(0)]
+ [TestCase(-1)]
+ [TestCase(-20)]
+ [TestCase(41)]
+ public void N2A_SetInvalidValue_ThrowsArgumentOutOfRangeException(int newN)
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ var properties = new ClosingStructuresFailurePathProperties(failureMechanism);
+
+ // Call
+ void Call() => properties.N2A = newN;
+
+ // Assert
+ const string expectedMessage = "De waarde voor 'N2A' moet in het bereik [0, 40] liggen.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage);
+ }
+
+ [Test]
+ [TestCase(1)]
+ [TestCase(10)]
+ [TestCase(20)]
+ public void N2A_SetValidValue_UpdateDataAndNotifyObservers(int newN)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.Attach(observer);
+
+ var properties = new ClosingStructuresFailurePathProperties(failureMechanism);
+
+ // Call
+ properties.N2A = newN;
+
+ // Assert
+ Assert.AreEqual(newN, failureMechanism.GeneralInput.N2A, failureMechanism.GeneralInput.N2A);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs
===================================================================
diff -u -rcf89119fc5a8184e0cbb07ec916d7b17c2e93a05 -rd480fcf3bc481eecc0568ee40d2dfa808505f8c2
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs (.../ClosingStructuresPluginTest.cs) (revision cf89119fc5a8184e0cbb07ec916d7b17c2e93a05)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs (.../ClosingStructuresPluginTest.cs) (revision d480fcf3bc481eecc0568ee40d2dfa808505f8c2)
@@ -62,12 +62,17 @@
PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray();
// Assert
- Assert.AreEqual(5, propertyInfos.Length);
+ Assert.AreEqual(6, propertyInfos.Length);
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
typeof(ClosingStructuresCalculationsContext),
typeof(ClosingStructuresCalculationsProperties));
+
+ PluginTestHelper.AssertPropertyInfoDefined(
+ propertyInfos,
+ typeof(ClosingStructuresFailurePathContext),
+ typeof(ClosingStructuresFailurePathProperties));
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,