Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresCalculationsProperties.cs
===================================================================
diff -u -rcf5d6df54992469dedce2a08784a5ade67f84426 -r818c24d35ba57363adc8064ea25a18521939d83e
--- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresCalculationsProperties.cs (.../HeightStructuresCalculationsProperties.cs) (revision cf5d6df54992469dedce2a08784a5ade67f84426)
+++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresCalculationsProperties.cs (.../HeightStructuresCalculationsProperties.cs) (revision 818c24d35ba57363adc8064ea25a18521939d83e)
@@ -38,11 +38,9 @@
private const int namePropertyIndex = 1;
private const int codePropertyIndex = 2;
private const int groupPropertyIndex = 3;
- private const int contributionPropertyIndex = 4;
- private const int gravitationalAccelerationPropertyIndex = 5;
- private const int nPropertyIndex = 6;
- private const int modelFactorOvertoppingFlowPropertyIndex = 7;
- private const int modelFactorStorageVolumePropertyIndex = 8;
+ private const int gravitationalAccelerationPropertyIndex = 4;
+ private const int modelFactorOvertoppingFlowPropertyIndex = 5;
+ private const int modelFactorStorageVolumePropertyIndex = 6;
///
/// Creates a new instance of .
@@ -53,9 +51,7 @@
{
NamePropertyIndex = namePropertyIndex,
CodePropertyIndex = codePropertyIndex,
- GroupPropertyIndex = groupPropertyIndex,
- ContributionPropertyIndex = contributionPropertyIndex,
- NPropertyIndex = nPropertyIndex
+ GroupPropertyIndex = groupPropertyIndex
}) {}
#region General
Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs
===================================================================
diff -u -r022e3f19dae753796da018acd230673a29194f61 -r818c24d35ba57363adc8064ea25a18521939d83e
--- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs (.../HeightStructuresFailureMechanismProperties.cs) (revision 022e3f19dae753796da018acd230673a29194f61)
+++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismProperties.cs (.../HeightStructuresFailureMechanismProperties.cs) (revision 818c24d35ba57363adc8064ea25a18521939d83e)
@@ -21,7 +21,6 @@
using System;
using System.Collections.Generic;
-using Core.Common.Base.Data;
using Core.Common.Util.Attributes;
using Core.Gui.Attributes;
using Core.Gui.PropertyBag;
@@ -68,37 +67,10 @@
},
{
nameof(Group), constructionProperties.GroupPropertyIndex
- },
- {
- nameof(Contribution), constructionProperties.ContributionPropertyIndex
- },
- {
- nameof(N), constructionProperties.NPropertyIndex
}
};
}
- #region Length effect parameters
-
- [DynamicPropertyOrder]
- [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))]
- [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_N_DisplayName))]
- [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_N_Description))]
- public RoundedDouble N
- {
- get
- {
- return data.GeneralInput.N;
- }
- set
- {
- data.GeneralInput.N = value;
- data.NotifyObservers();
- }
- }
-
- #endregion
-
[DynamicPropertyOrderEvaluationMethod]
public int DynamicPropertyOrderEvaluationMethod(string propertyName)
{
@@ -112,15 +84,6 @@
///
public class ConstructionProperties
{
- #region Length effect parameters
-
- ///
- /// Gets or sets the property index for .
- ///
- public int NPropertyIndex { get; set; }
-
- #endregion
-
#region General
///
@@ -138,11 +101,6 @@
///
public int GroupPropertyIndex { get; set; }
- ///
- /// Gets or sets the property index for .
- ///
- public int ContributionPropertyIndex { get; set; }
-
#endregion
}
@@ -184,18 +142,6 @@
}
}
- [DynamicPropertyOrder]
- [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
- [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Contribution_DisplayName))]
- [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Contribution_Description))]
- public double Contribution
- {
- get
- {
- return data.Contribution;
- }
- }
-
#endregion
}
}
\ No newline at end of file
Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailurePathProperties.cs
===================================================================
diff -u -rcf5d6df54992469dedce2a08784a5ade67f84426 -r818c24d35ba57363adc8064ea25a18521939d83e
--- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailurePathProperties.cs (.../HeightStructuresFailurePathProperties.cs) (revision cf5d6df54992469dedce2a08784a5ade67f84426)
+++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/PropertyClasses/HeightStructuresFailurePathProperties.cs (.../HeightStructuresFailurePathProperties.cs) (revision 818c24d35ba57363adc8064ea25a18521939d83e)
@@ -20,6 +20,9 @@
// All rights reserved.
using System;
+using Core.Common.Base.Data;
+using Core.Common.Util.Attributes;
+using Core.Gui.Attributes;
using Riskeer.HeightStructures.Data;
using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
@@ -45,9 +48,44 @@
{
NamePropertyIndex = namePropertyIndex,
CodePropertyIndex = codePropertyIndex,
- GroupPropertyIndex = groupPropertyIndex,
- ContributionPropertyIndex = contributionPropertyIndex,
- NPropertyIndex = nPropertyIndex
+ GroupPropertyIndex = groupPropertyIndex
}) {}
+
+ #region General
+
+ [PropertyOrder(contributionPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Contribution_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Contribution_Description))]
+ public double Contribution
+ {
+ get
+ {
+ return data.Contribution;
+ }
+ }
+
+ #endregion
+
+ #region Length effect parameters
+
+ [PropertyOrder(nPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_N_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_N_Description))]
+ public RoundedDouble N
+ {
+ get
+ {
+ return data.GeneralInput.N;
+ }
+ set
+ {
+ data.GeneralInput.N = value;
+ data.NotifyObservers();
+ }
+ }
+
+ #endregion
}
}
\ No newline at end of file
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresCalculationsPropertiesTest.cs
===================================================================
diff -u -r5b3dc6fdc32292d4b9761494d4842e1090f44aca -r818c24d35ba57363adc8064ea25a18521939d83e
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresCalculationsPropertiesTest.cs (.../HeightStructuresCalculationsPropertiesTest.cs) (revision 5b3dc6fdc32292d4b9761494d4842e1090f44aca)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresCalculationsPropertiesTest.cs (.../HeightStructuresCalculationsPropertiesTest.cs) (revision 818c24d35ba57363adc8064ea25a18521939d83e)
@@ -34,11 +34,9 @@
private const int namePropertyIndex = 0;
private const int codePropertyIndex = 1;
private const int groupPropertyIndex = 2;
- private const int contributionPropertyIndex = 3;
- private const int gravitationalAccelerationPropertyIndex = 4;
- private const int nPropertyIndex = 5;
- private const int modelFactorOvertoppingFlowPropertyIndex = 6;
- private const int modelFactorStorageVolumePropertyIndex = 7;
+ private const int gravitationalAccelerationPropertyIndex = 3;
+ private const int modelFactorOvertoppingFlowPropertyIndex = 4;
+ private const int modelFactorStorageVolumePropertyIndex = 5;
[Test]
public void Constructor_ExpectedValues()
@@ -55,10 +53,8 @@
Assert.AreEqual(failureMechanism.Name, properties.Name);
Assert.AreEqual(failureMechanism.Code, properties.Code);
Assert.AreEqual(failureMechanism.Group, properties.Group);
- Assert.AreEqual(failureMechanism.Contribution, properties.Contribution);
GeneralHeightStructuresInput generalInput = failureMechanism.GeneralInput;
- Assert.AreEqual(generalInput.N, properties.N);
Assert.AreEqual(generalInput.GravitationalAcceleration, properties.GravitationalAcceleration);
Assert.AreEqual(generalInput.ModelFactorOvertoppingFlow.Mean, properties.ModelFactorOvertoppingFlow.Mean);
@@ -76,11 +72,10 @@
// Assert
const string generalCategory = "Algemeen";
- const string lengthEffectCategory = "Lengte-effect parameters";
const string modelSettingsCategory = "Modelinstellingen";
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
- Assert.AreEqual(8, dynamicProperties.Count);
+ Assert.AreEqual(6, dynamicProperties.Count);
PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
@@ -103,26 +98,13 @@
"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 gravitationalAccelerationProperty = dynamicProperties[gravitationalAccelerationPropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(gravitationalAccelerationProperty,
generalCategory,
"Valversnelling [m/s²]",
"Valversnelling.",
true);
- 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.");
-
PropertyDescriptor modelFactorOvertoppingFlowProperty = dynamicProperties[modelFactorOvertoppingFlowPropertyIndex];
Assert.IsInstanceOf(modelFactorOvertoppingFlowProperty.Converter);
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorOvertoppingFlowProperty,
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs
===================================================================
diff -u -rcea05e75014e2f836db38cf81598a87bc88166a3 -r818c24d35ba57363adc8064ea25a18521939d83e
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs (.../HeightStructuresFailureMechanismPropertiesTest.cs) (revision cea05e75014e2f836db38cf81598a87bc88166a3)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs (.../HeightStructuresFailureMechanismPropertiesTest.cs) (revision 818c24d35ba57363adc8064ea25a18521939d83e)
@@ -21,26 +21,19 @@
using System;
using System.ComponentModel;
-using Core.Common.Base;
-using Core.Common.Base.Data;
-using Core.Common.TestUtil;
using Core.Gui.PropertyBag;
using Core.Gui.TestUtil;
using NUnit.Framework;
-using Rhino.Mocks;
-using Riskeer.Common.Data.TestUtil;
using Riskeer.HeightStructures.Data;
using Riskeer.HeightStructures.Forms.PropertyClasses;
namespace Riskeer.HeightStructures.Forms.Test.PropertyClasses
{
public class HeightStructuresFailureMechanismPropertiesTest
{
- private const int namePropertyIndex = 4;
- private const int codePropertyIndex = 3;
- private const int groupPropertyIndex = 2;
- private const int contributionPropertyIndex = 1;
- private const int nPropertyIndex = 0;
+ private const int namePropertyIndex = 2;
+ private const int codePropertyIndex = 1;
+ private const int groupPropertyIndex = 0;
[Test]
public void Constructor_DataNull_ThrowArgumentNullException()
@@ -78,12 +71,6 @@
Assert.AreEqual(failureMechanism.Name, properties.Name);
Assert.AreEqual(failureMechanism.Code, properties.Code);
Assert.AreEqual(failureMechanism.Group, properties.Group);
- Assert.AreEqual(failureMechanism.Contribution, properties.Contribution);
-
- Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
- Assert.AreEqual(failureMechanism.GeneralInput.N,
- properties.N,
- properties.N.GetAccuracy());
}
[Test]
@@ -97,17 +84,14 @@
{
NamePropertyIndex = namePropertyIndex,
CodePropertyIndex = codePropertyIndex,
- GroupPropertyIndex = groupPropertyIndex,
- ContributionPropertyIndex = contributionPropertyIndex,
- NPropertyIndex = nPropertyIndex
+ GroupPropertyIndex = groupPropertyIndex
});
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
- Assert.AreEqual(5, dynamicProperties.Count);
+ Assert.AreEqual(3, dynamicProperties.Count);
const string generalCategory = "Algemeen";
- const string lengthEffectCategory = "Lengte-effect parameters";
PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
@@ -129,72 +113,6 @@
"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 nProperty = dynamicProperties[nPropertyIndex];
- PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nProperty,
- lengthEffectCategory,
- "N [-]",
- "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling.");
}
-
- [Test]
- [SetCulture("nl-NL")]
- [TestCase(0.0)]
- [TestCase(-1.0)]
- [TestCase(-20.0)]
- public void N_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double newN)
- {
- // Setup
- var mocks = new MockRepository();
- var observer = mocks.StrictMock();
- mocks.ReplayAll();
-
- var failureMechanism = new HeightStructuresFailureMechanism();
- failureMechanism.Attach(observer);
-
- var properties = new HeightStructuresFailureMechanismProperties(failureMechanism, new HeightStructuresFailureMechanismProperties.ConstructionProperties());
-
- // Call
- void Call() => properties.N = (RoundedDouble) newN;
-
- // Assert
- const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage);
-
- mocks.VerifyAll();
- }
-
- [Test]
- [TestCase(1.0)]
- [TestCase(10.0)]
- [TestCase(20.0)]
- public void N_SetValidValue_UpdateDataAndNotifyObservers(double newN)
- {
- // Setup
- var mocks = new MockRepository();
- var observer = mocks.StrictMock();
- observer.Expect(o => o.UpdateObserver());
- mocks.ReplayAll();
-
- var failureMechanism = new HeightStructuresFailureMechanism();
- failureMechanism.Attach(observer);
-
- var properties = new HeightStructuresFailureMechanismProperties(failureMechanism, new HeightStructuresFailureMechanismProperties.ConstructionProperties());
-
- // Call
- properties.N = (RoundedDouble) newN;
-
- // Assert
- Assert.AreEqual(newN, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
-
- mocks.VerifyAll();
- }
}
}
\ No newline at end of file
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailurePathPropertiesTest.cs
===================================================================
diff -u -r5b3dc6fdc32292d4b9761494d4842e1090f44aca -r818c24d35ba57363adc8064ea25a18521939d83e
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailurePathPropertiesTest.cs (.../HeightStructuresFailurePathPropertiesTest.cs) (revision 5b3dc6fdc32292d4b9761494d4842e1090f44aca)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailurePathPropertiesTest.cs (.../HeightStructuresFailurePathPropertiesTest.cs) (revision 818c24d35ba57363adc8064ea25a18521939d83e)
@@ -19,9 +19,14 @@
// 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.Base.Data;
+using Core.Common.TestUtil;
using Core.Gui.TestUtil;
using NUnit.Framework;
+using Rhino.Mocks;
using Riskeer.Common.Data.TestUtil;
using Riskeer.HeightStructures.Data;
using Riskeer.HeightStructures.Forms.PropertyClasses;
@@ -109,5 +114,58 @@
"N [-]",
"De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling.");
}
+
+ [Test]
+ [SetCulture("nl-NL")]
+ [TestCase(0.0)]
+ [TestCase(-1.0)]
+ [TestCase(-20.0)]
+ public void N_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double newN)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ failureMechanism.Attach(observer);
+
+ var properties = new HeightStructuresFailurePathProperties(failureMechanism);
+
+ // Call
+ void Call() => properties.N = (RoundedDouble) newN;
+
+ // Assert
+ const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(1.0)]
+ [TestCase(10.0)]
+ [TestCase(20.0)]
+ public void N_SetValidValue_UpdateDataAndNotifyObservers(double newN)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ failureMechanism.Attach(observer);
+
+ var properties = new HeightStructuresFailurePathProperties(failureMechanism);
+
+ // Call
+ properties.N = (RoundedDouble) newN;
+
+ // Assert
+ Assert.AreEqual(newN, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ mocks.VerifyAll();
+ }
}
}
\ No newline at end of file