Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/ReferenceLineProperties.cs
===================================================================
diff -u -rbb7246a859710e284b10c855848be97b8bc0b463 -r558241ef9493905c11075a1408aa1d209678f5ff
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/ReferenceLineProperties.cs (.../ReferenceLineProperties.cs) (revision bb7246a859710e284b10c855848be97b8bc0b463)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/ReferenceLineProperties.cs (.../ReferenceLineProperties.cs) (revision 558241ef9493905c11075a1408aa1d209678f5ff)
@@ -35,26 +35,27 @@
namespace Ringtoets.Integration.Forms.PropertyClasses
{
///
- /// ViewModel of for properties panel.
+ /// ViewModel of a in the
+ /// for properties panel.
///
- public class ReferenceLineProperties : ObjectProperties
+ public class ReferenceLineProperties : ObjectProperties
{
private const int lengthPropertyIndex = 1;
private const int geometryPropertyIndex = 2;
///
/// Creates a new instance of .
///
- /// The to show the properties for.
- /// Thrown when is null.
- public ReferenceLineProperties(ReferenceLine referenceLine)
+ /// The assessment section to show the reference line properties for.
+ /// Thrown when is null.
+ public ReferenceLineProperties(IAssessmentSection assessmentSection)
{
- if (referenceLine == null)
+ if (assessmentSection == null)
{
- throw new ArgumentNullException(nameof(referenceLine));
+ throw new ArgumentNullException(nameof(assessmentSection));
}
- Data = referenceLine;
+ Data = assessmentSection;
}
[PropertyOrder(lengthPropertyIndex)]
@@ -65,7 +66,7 @@
{
get
{
- return new RoundedDouble(2, data.Length);
+ return new RoundedDouble(2, data.ReferenceLine.Length);
}
}
@@ -78,7 +79,7 @@
{
get
{
- return data.Points.ToArray();
+ return data.ReferenceLine.Points.ToArray();
}
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -rf730cc647492866c7c77b96c9e44b0bd4208142c -r558241ef9493905c11075a1408aa1d209678f5ff
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision f730cc647492866c7c77b96c9e44b0bd4208142c)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 558241ef9493905c11075a1408aa1d209678f5ff)
@@ -365,7 +365,7 @@
};
yield return new PropertyInfo
{
- CreateInstance = context => new ReferenceLineProperties(context.WrappedData.ReferenceLine)
+ CreateInstance = context => new ReferenceLineProperties(context.WrappedData)
};
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/ReferenceLinePropertiesTest.cs
===================================================================
diff -u -rbb7246a859710e284b10c855848be97b8bc0b463 -r558241ef9493905c11075a1408aa1d209678f5ff
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/ReferenceLinePropertiesTest.cs (.../ReferenceLinePropertiesTest.cs) (revision bb7246a859710e284b10c855848be97b8bc0b463)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/ReferenceLinePropertiesTest.cs (.../ReferenceLinePropertiesTest.cs) (revision 558241ef9493905c11075a1408aa1d209678f5ff)
@@ -27,6 +27,7 @@
using Core.Common.Gui.PropertyBag;
using Core.Common.TestUtil;
using NUnit.Framework;
+using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Integration.Forms.PropertyClasses;
@@ -37,60 +38,73 @@
public class ReferenceLinePropertiesTest
{
[Test]
- public void Constructor_ReferenceLineNull_ThrowsArgumentNullException()
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
{
// Call
TestDelegate call = () => new ReferenceLineProperties(null);
// Assert
string paramName = Assert.Throws(call).ParamName;
- Assert.AreEqual("referenceLine", paramName);
+ Assert.AreEqual("assessmentSection", paramName);
}
[Test]
- public void Constructor_WithReferenceLine_ExpectedValues()
+ public void Constructor_WithAssessmentSection_ExpectedValues()
{
// Setup
- var referenceLine = new ReferenceLine();
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
// Call
- var properties = new ReferenceLineProperties(referenceLine);
+ var properties = new ReferenceLineProperties(assessmentSection);
// Assert
- Assert.IsInstanceOf>(properties);
+ Assert.IsInstanceOf>(properties);
TestHelper.AssertTypeConverter(
nameof(ReferenceLineProperties.Geometry));
- Assert.AreSame(referenceLine, properties.Data);
+ Assert.AreSame(assessmentSection, properties.Data);
+ mocks.VerifyAll();
}
[Test]
public void GetProperties_WithData_ReturnExpectedValues()
{
// Setup
var random = new Random(39);
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
var referenceLine = new ReferenceLine();
var geometry = new List
{
new Point2D(random.NextDouble(), random.NextDouble()),
new Point2D(random.NextDouble(), random.NextDouble())
};
referenceLine.SetGeometry(geometry);
+ assessmentSection.ReferenceLine = referenceLine;
+ mocks.ReplayAll();
- var properties = new ReferenceLineProperties(referenceLine);
+ var properties = new ReferenceLineProperties(assessmentSection);
// Call & Assert
Assert.AreEqual(2, properties.Length.NumberOfDecimalPlaces);
Assert.AreEqual(referenceLine.Length, properties.Length, properties.Length.GetAccuracy());
CollectionAssert.AreEqual(geometry, properties.Geometry);
+ mocks.VerifyAll();
}
[Test]
public void Constructor_ValidData_PropertiesHaveExpectedAttributeValues()
{
// Call
- var properties = new ReferenceLineProperties(new ReferenceLine());
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+ var properties = new ReferenceLineProperties(assessmentSection);
+
// Assert
PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
@@ -109,8 +123,10 @@
PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(geometryProperty,
generalCategoryName,
"Coördinaten",
- "Lijst van alle coördinaten (X-coördinaat, Y-coördinaat) die samen de referentielijn vormen.",
+ "Lijst van alle coördinaten (X-coördinaat, Y-coördinaat) " +
+ "die samen de referentielijn vormen.",
true);
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/ReferenceLinePropertyInfoTest.cs
===================================================================
diff -u -r8c7c25ee0b61c182e38073f56cb6376c511ccbf2 -r558241ef9493905c11075a1408aa1d209678f5ff
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/ReferenceLinePropertyInfoTest.cs (.../ReferenceLinePropertyInfoTest.cs) (revision 8c7c25ee0b61c182e38073f56cb6376c511ccbf2)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/ReferenceLinePropertyInfoTest.cs (.../ReferenceLinePropertyInfoTest.cs) (revision 558241ef9493905c11075a1408aa1d209678f5ff)
@@ -71,7 +71,7 @@
// Assert
Assert.IsInstanceOf(objectProperties);
- Assert.AreSame(context.WrappedData.ReferenceLine, objectProperties.Data);
+ Assert.AreSame(context.WrappedData, objectProperties.Data);
}
}
}
\ No newline at end of file