Index: Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresCalculationsProperties.cs
===================================================================
diff -u -r8771ca236c6ddba55462f9dd5cce49b12880df66 -r9b96fbd9683bc9fe1f4b96f149e090972bfa578c
--- Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresCalculationsProperties.cs (.../StabilityPointStructuresCalculationsProperties.cs) (revision 8771ca236c6ddba55462f9dd5cce49b12880df66)
+++ Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresCalculationsProperties.cs (.../StabilityPointStructuresCalculationsProperties.cs) (revision 9b96fbd9683bc9fe1f4b96f149e090972bfa578c)
@@ -39,13 +39,11 @@
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 modelFactorStorageVolumePropertyIndex = 7;
- private const int modelFactorCollisionLoadPropertyIndex = 8;
- private const int modelFactorLoadEffectPropertyIndex = 9;
- private const int modelFactorLongThresholdPropertyIndex = 10;
+ private const int gravitationalAccelerationPropertyIndex = 4;
+ private const int modelFactorStorageVolumePropertyIndex = 5;
+ private const int modelFactorCollisionLoadPropertyIndex = 6;
+ private const int modelFactorLoadEffectPropertyIndex = 7;
+ private const int modelFactorLongThresholdPropertyIndex = 8;
///
/// Creates a new instance of .
@@ -56,9 +54,7 @@
{
NamePropertyIndex = namePropertyIndex,
CodePropertyIndex = codePropertyIndex,
- GroupPropertyIndex = groupPropertyIndex,
- ContributionPropertyIndex = contributionPropertyIndex,
- NPropertyIndex = nPropertyIndex
+ GroupPropertyIndex = groupPropertyIndex
}) {}
#region General
Index: Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresFailureMechanismProperties.cs
===================================================================
diff -u -r3a3fe11bf17281e359f41fc779a59258cd6a8dff -r9b96fbd9683bc9fe1f4b96f149e090972bfa578c
--- Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresFailureMechanismProperties.cs (.../StabilityPointStructuresFailureMechanismProperties.cs) (revision 3a3fe11bf17281e359f41fc779a59258cd6a8dff)
+++ Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresFailureMechanismProperties.cs (.../StabilityPointStructuresFailureMechanismProperties.cs) (revision 9b96fbd9683bc9fe1f4b96f149e090972bfa578c)
@@ -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/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresFailurePathProperties.cs
===================================================================
diff -u -r8771ca236c6ddba55462f9dd5cce49b12880df66 -r9b96fbd9683bc9fe1f4b96f149e090972bfa578c
--- Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresFailurePathProperties.cs (.../StabilityPointStructuresFailurePathProperties.cs) (revision 8771ca236c6ddba55462f9dd5cce49b12880df66)
+++ Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/PropertyClasses/StabilityPointStructuresFailurePathProperties.cs (.../StabilityPointStructuresFailurePathProperties.cs) (revision 9b96fbd9683bc9fe1f4b96f149e090972bfa578c)
@@ -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.StabilityPointStructures.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/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresCalculationsPropertiesTest.cs
===================================================================
diff -u -r92d09ddedac41a7c4aa797d76fdce1495a10c2d3 -r9b96fbd9683bc9fe1f4b96f149e090972bfa578c
--- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresCalculationsPropertiesTest.cs (.../StabilityPointStructuresCalculationsPropertiesTest.cs) (revision 92d09ddedac41a7c4aa797d76fdce1495a10c2d3)
+++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresCalculationsPropertiesTest.cs (.../StabilityPointStructuresCalculationsPropertiesTest.cs) (revision 9b96fbd9683bc9fe1f4b96f149e090972bfa578c)
@@ -35,13 +35,11 @@
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 modelFactorStorageVolumePropertyIndex = 6;
- private const int modelFactorCollisionLoadPropertyIndex = 7;
- private const int modelFactorLoadEffectPropertyIndex = 8;
- private const int modelFactorLongThresholdPropertyIndex = 9;
+ private const int gravitationalAccelerationPropertyIndex = 3;
+ private const int modelFactorStorageVolumePropertyIndex = 4;
+ private const int modelFactorCollisionLoadPropertyIndex = 5;
+ private const int modelFactorLoadEffectPropertyIndex = 6;
+ private const int modelFactorLongThresholdPropertyIndex = 7;
[Test]
public void Constructor_DataIsNull_ThrowArgumentNullException()
@@ -69,10 +67,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);
GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput;
- Assert.AreEqual(generalInput.N, properties.N);
Assert.AreEqual(generalInput.GravitationalAcceleration, properties.GravitationalAcceleration);
Assert.AreEqual(generalInput.ModelFactorStorageVolume.Mean, properties.ModelFactorStorageVolume.Mean);
Assert.AreEqual(generalInput.ModelFactorStorageVolume.StandardDeviation, properties.ModelFactorStorageVolume.StandardDeviation);
@@ -95,11 +91,10 @@
// Assert
const string generalCategory = "Algemeen";
- const string lengthEffectCategory = "Lengte-effect parameters";
const string modelSettingsCategory = "Modelinstellingen";
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
- Assert.AreEqual(10, dynamicProperties.Count);
+ Assert.AreEqual(8, dynamicProperties.Count);
PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
@@ -122,26 +117,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 modelFactorStorageVolumeProperty = dynamicProperties[modelFactorStorageVolumePropertyIndex];
Assert.IsInstanceOf(modelFactorStorageVolumeProperty.Converter);
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorStorageVolumeProperty,
Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs
===================================================================
diff -u -r8771ca236c6ddba55462f9dd5cce49b12880df66 -r9b96fbd9683bc9fe1f4b96f149e090972bfa578c
--- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs (.../StabilityPointStructuresFailureMechanismPropertiesTest.cs) (revision 8771ca236c6ddba55462f9dd5cce49b12880df66)
+++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs (.../StabilityPointStructuresFailureMechanismPropertiesTest.cs) (revision 9b96fbd9683bc9fe1f4b96f149e090972bfa578c)
@@ -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.StabilityPointStructures.Data;
using Riskeer.StabilityPointStructures.Forms.PropertyClasses;
namespace Riskeer.StabilityPointStructures.Forms.Test.PropertyClasses
{
public class StabilityPointStructuresFailureMechanismPropertiesTest
{
- 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_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double value)
- {
- // Setup
- var mocks = new MockRepository();
- var observer = mocks.StrictMock();
- mocks.ReplayAll();
-
- var failureMechanism = new StabilityPointStructuresFailureMechanism();
- failureMechanism.Attach(observer);
-
- var properties = new StabilityPointStructuresFailureMechanismProperties(failureMechanism, new StabilityPointStructuresFailureMechanismProperties.ConstructionProperties());
-
- // Call
- void Call() => properties.N = (RoundedDouble) value;
-
- // 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 value)
- {
- // Setup
- var mocks = new MockRepository();
- var observer = mocks.StrictMock();
- observer.Expect(o => o.UpdateObserver());
- mocks.ReplayAll();
-
- var failureMechanism = new StabilityPointStructuresFailureMechanism();
- failureMechanism.Attach(observer);
-
- var properties = new StabilityPointStructuresFailureMechanismProperties(failureMechanism, new StabilityPointStructuresFailureMechanismProperties.ConstructionProperties());
-
- // Call
- properties.N = (RoundedDouble) value;
-
- // Assert
- Assert.AreEqual(value, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
-
- mocks.VerifyAll();
- }
}
}
\ No newline at end of file
Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailurePathPropertiesTest.cs
===================================================================
diff -u -r92d09ddedac41a7c4aa797d76fdce1495a10c2d3 -r9b96fbd9683bc9fe1f4b96f149e090972bfa578c
--- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailurePathPropertiesTest.cs (.../StabilityPointStructuresFailurePathPropertiesTest.cs) (revision 92d09ddedac41a7c4aa797d76fdce1495a10c2d3)
+++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailurePathPropertiesTest.cs (.../StabilityPointStructuresFailurePathPropertiesTest.cs) (revision 9b96fbd9683bc9fe1f4b96f149e090972bfa578c)
@@ -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.StabilityPointStructures.Data;
using Riskeer.StabilityPointStructures.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_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double value)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ failureMechanism.Attach(observer);
+
+ var properties = new StabilityPointStructuresFailurePathProperties(failureMechanism);
+
+ // Call
+ void Call() => properties.N = (RoundedDouble) value;
+
+ // 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 value)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ failureMechanism.Attach(observer);
+
+ var properties = new StabilityPointStructuresFailurePathProperties(failureMechanism);
+
+ // Call
+ properties.N = (RoundedDouble) value;
+
+ // Assert
+ Assert.AreEqual(value, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ mocks.VerifyAll();
+ }
}
}
\ No newline at end of file