Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionProbabilityAssessmentProperties.cs
===================================================================
diff -u -rdb399c3f94284852ca23773a931a43338f281e90 -rdbc19eb83d1a3fc64a5f4f4bc2889583a65b4656
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionProbabilityAssessmentProperties.cs (.../FailureMechanismSectionProbabilityAssessmentProperties.cs) (revision db399c3f94284852ca23773a931a43338f281e90)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionProbabilityAssessmentProperties.cs (.../FailureMechanismSectionProbabilityAssessmentProperties.cs) (revision dbc19eb83d1a3fc64a5f4f4bc2889583a65b4656)
@@ -41,12 +41,17 @@
/// Creates a new instance of .
///
/// The section to show the properties for.
+ /// The start of the section from the beginning
+ /// of the reference line in meters.
+ /// The end of the section from the beginning of
+ /// the reference line in meters.
/// The probability assessment input belonging to the
/// failure mechanism of the properties.
/// Thrown when any input parameter is null.
public FailureMechanismSectionProbabilityAssessmentProperties(FailureMechanismSection section,
+ double sectionStart, double sectionEnd,
ProbabilityAssessmentInput probabilityAssessmentInput)
- : base(section)
+ : base(section, sectionStart, sectionEnd)
{
if (probabilityAssessmentInput == null)
{
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionProperties.cs
===================================================================
diff -u -rdb399c3f94284852ca23773a931a43338f281e90 -rdbc19eb83d1a3fc64a5f4f4bc2889583a65b4656
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionProperties.cs (.../FailureMechanismSectionProperties.cs) (revision db399c3f94284852ca23773a931a43338f281e90)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionProperties.cs (.../FailureMechanismSectionProperties.cs) (revision dbc19eb83d1a3fc64a5f4f4bc2889583a65b4656)
@@ -41,16 +41,22 @@
/// Creates a new instance of .
///
/// The section to show the properties for.
+ /// The start of the section from the beginning
+ /// of the reference line in meters.
+ /// The end of the section from the beginning of
+ /// the reference line in meters.
/// Thrown when
/// is null.
- public FailureMechanismSectionProperties(FailureMechanismSection section)
+ public FailureMechanismSectionProperties(FailureMechanismSection section, double sectionStart, double sectionEnd)
{
if (section == null)
{
throw new ArgumentNullException(nameof(section));
}
data = section;
+ SectionStart = new RoundedDouble(2, sectionStart);
+ SectionEnd = new RoundedDouble(2, sectionEnd);
}
[PropertyOrder(1)]
@@ -69,25 +75,13 @@
[ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
[ResourcesDisplayName(typeof(Resources), nameof(Resources.SectionStart_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.SectionStart_Description))]
- public RoundedDouble SectionStart
- {
- get
- {
- return new RoundedDouble(2);
- }
- }
+ public RoundedDouble SectionStart { get; }
[PropertyOrder(3)]
[ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
[ResourcesDisplayName(typeof(Resources), nameof(Resources.SectionEnd_DisplayName))]
[ResourcesDescription(typeof(Resources), nameof(Resources.SectionEnd_Description))]
- public RoundedDouble SectionEnd
- {
- get
- {
- return new RoundedDouble(2);
- }
- }
+ public RoundedDouble SectionEnd { get; }
[PropertyOrder(4)]
[ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))]
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentProperties.cs
===================================================================
diff -u -r94f14096f9a5565b9f961c7b7e1822ef0976a42a -rdbc19eb83d1a3fc64a5f4f4bc2889583a65b4656
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentProperties.cs (.../FailureMechanismSectionsProbabilityAssessmentProperties.cs) (revision 94f14096f9a5565b9f961c7b7e1822ef0976a42a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentProperties.cs (.../FailureMechanismSectionsProbabilityAssessmentProperties.cs) (revision dbc19eb83d1a3fc64a5f4f4bc2889583a65b4656)
@@ -92,7 +92,8 @@
{
get
{
- return data.Sections.Select(section => new FailureMechanismSectionProbabilityAssessmentProperties(section, probabilityAssessmentInput)).ToArray();
+ return data.Sections.Select(section => new FailureMechanismSectionProbabilityAssessmentProperties(section, 0, 0,
+ probabilityAssessmentInput)).ToArray();
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProperties.cs
===================================================================
diff -u -r94f14096f9a5565b9f961c7b7e1822ef0976a42a -rdbc19eb83d1a3fc64a5f4f4bc2889583a65b4656
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProperties.cs (.../FailureMechanismSectionsProperties.cs) (revision 94f14096f9a5565b9f961c7b7e1822ef0976a42a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FailureMechanismSectionsProperties.cs (.../FailureMechanismSectionsProperties.cs) (revision dbc19eb83d1a3fc64a5f4f4bc2889583a65b4656)
@@ -81,7 +81,7 @@
{
get
{
- return data.Sections.Select(section => new FailureMechanismSectionProperties(section)).ToArray();
+ return data.Sections.Select(section => new FailureMechanismSectionProperties(section, 0, 0)).ToArray();
}
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionProbabilityAssessmentPropertiesTest.cs
===================================================================
diff -u -rdb399c3f94284852ca23773a931a43338f281e90 -rdbc19eb83d1a3fc64a5f4f4bc2889583a65b4656
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionProbabilityAssessmentPropertiesTest.cs (.../FailureMechanismSectionProbabilityAssessmentPropertiesTest.cs) (revision db399c3f94284852ca23773a931a43338f281e90)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionProbabilityAssessmentPropertiesTest.cs (.../FailureMechanismSectionProbabilityAssessmentPropertiesTest.cs) (revision dbc19eb83d1a3fc64a5f4f4bc2889583a65b4656)
@@ -40,7 +40,7 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
// Call
- TestDelegate call = () => new FailureMechanismSectionProbabilityAssessmentProperties(section, null);
+ TestDelegate call = () => new FailureMechanismSectionProbabilityAssessmentProperties(section, double.NaN, double.NaN, null);
// Assert
var exception = Assert.Throws(call);
@@ -51,11 +51,15 @@
public void Constructor_ExpectedValues()
{
// Setup
+ var random = new Random(21);
+ double sectionStart = random.NextDouble();
+ double sectionEnd = random.NextDouble();
+
var probabilityAssessmentInput = new TestProbabilityAssessmentInput(0.5, 100);
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
// Call
- var properties = new FailureMechanismSectionProbabilityAssessmentProperties(section, probabilityAssessmentInput);
+ var properties = new FailureMechanismSectionProbabilityAssessmentProperties(section, sectionStart, sectionEnd, probabilityAssessmentInput);
// Assert
Assert.IsInstanceOf(properties);
@@ -64,6 +68,9 @@
Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
Assert.AreEqual(1.0, properties.N, properties.N.GetAccuracy());
+
+ Assert.AreEqual(sectionStart, properties.SectionStart, properties.SectionStart.GetAccuracy());
+ Assert.AreEqual(sectionEnd, properties.SectionEnd, properties.SectionEnd.GetAccuracy());
}
[Test]
@@ -74,7 +81,7 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
// Call
- var properties = new FailureMechanismSectionProbabilityAssessmentProperties(section, probabilityAssessmentInput);
+ var properties = new FailureMechanismSectionProbabilityAssessmentProperties(section, double.NaN, double.NaN, probabilityAssessmentInput);
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionPropertiesTest.cs
===================================================================
diff -u -rdb399c3f94284852ca23773a931a43338f281e90 -rdbc19eb83d1a3fc64a5f4f4bc2889583a65b4656
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionPropertiesTest.cs (.../FailureMechanismSectionPropertiesTest.cs) (revision db399c3f94284852ca23773a931a43338f281e90)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionPropertiesTest.cs (.../FailureMechanismSectionPropertiesTest.cs) (revision dbc19eb83d1a3fc64a5f4f4bc2889583a65b4656)
@@ -37,7 +37,7 @@
public void Constructor_SectionNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new FailureMechanismSectionProperties(null);
+ TestDelegate call = () => new FailureMechanismSectionProperties(null, double.NaN, double.NaN);
// Assert
var exception = Assert.Throws(call);
@@ -48,10 +48,13 @@
public void Constructor_ExpectedValues()
{
// Setup
+ var random = new Random(21);
+ double sectionStart = random.NextDouble();
+ double sectionEnd = random.NextDouble();
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
// Call
- var properties = new FailureMechanismSectionProperties(section);
+ var properties = new FailureMechanismSectionProperties(section, sectionStart, sectionEnd);
// Assert
Assert.IsInstanceOf>(properties);
@@ -65,9 +68,9 @@
Assert.AreEqual(section.EndPoint, properties.EndPoint);
Assert.AreEqual(2, properties.SectionStart.NumberOfDecimalPlaces);
- Assert.AreEqual(0.0, properties.SectionStart);
+ Assert.AreEqual(sectionStart, properties.SectionStart, properties.SectionStart.GetAccuracy());
Assert.AreEqual(2, properties.SectionEnd.NumberOfDecimalPlaces);
- Assert.AreEqual(0.0, properties.SectionEnd);
+ Assert.AreEqual(sectionEnd, properties.SectionEnd, properties.SectionEnd.GetAccuracy());
}
[Test]
@@ -77,7 +80,7 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
// Call
- var properties = new FailureMechanismSectionProperties(section);
+ var properties = new FailureMechanismSectionProperties(section, double.NaN, double.NaN);
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
@@ -126,7 +129,7 @@
{
// Setup
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
- var properties = new FailureMechanismSectionProperties(section);
+ var properties = new FailureMechanismSectionProperties(section, double.NaN, double.NaN);
// Call
string toString = properties.ToString();
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentPropertiesTest.cs
===================================================================
diff -u -r9c62dbc3f18cb81172af025c25ef3cc7b5578035 -rdbc19eb83d1a3fc64a5f4f4bc2889583a65b4656
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentPropertiesTest.cs (.../FailureMechanismSectionsProbabilityAssessmentPropertiesTest.cs) (revision 9c62dbc3f18cb81172af025c25ef3cc7b5578035)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionsProbabilityAssessmentPropertiesTest.cs (.../FailureMechanismSectionsProbabilityAssessmentPropertiesTest.cs) (revision dbc19eb83d1a3fc64a5f4f4bc2889583a65b4656)
@@ -109,6 +109,9 @@
Assert.AreEqual(1 + probabilityAssessmentInput.A * section.Length / probabilityAssessmentInput.B,
property.N,
property.N.GetAccuracy());
+
+ Assert.AreEqual(0, property.SectionStart, property.SectionStart.GetAccuracy());
+ Assert.AreEqual(0, property.SectionEnd, property.SectionEnd.GetAccuracy());
}
Assert.AreEqual(sourcePath, properties.SourcePath);
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionsPropertiesTest.cs
===================================================================
diff -u -r9c62dbc3f18cb81172af025c25ef3cc7b5578035 -rdbc19eb83d1a3fc64a5f4f4bc2889583a65b4656
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionsPropertiesTest.cs (.../FailureMechanismSectionsPropertiesTest.cs) (revision 9c62dbc3f18cb81172af025c25ef3cc7b5578035)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FailureMechanismSectionsPropertiesTest.cs (.../FailureMechanismSectionsPropertiesTest.cs) (revision dbc19eb83d1a3fc64a5f4f4bc2889583a65b4656)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2017. All rights reserved.
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
//
// This file is part of Ringtoets.
//
@@ -77,6 +77,8 @@
FailureMechanismSection section = sections.ElementAt(i);
FailureMechanismSectionProperties property = properties.Sections[i];
Assert.AreSame(section, property.Data);
+ Assert.AreEqual(0, property.SectionStart, property.SectionStart.GetAccuracy());
+ Assert.AreEqual(0, property.SectionEnd, property.SectionEnd.GetAccuracy());
}
Assert.AreEqual(sourcePath, properties.SourcePath);