Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/HydraulicBoundaryLocationContext.cs
===================================================================
diff -u -r0f28eb71a18af127ad376776ebd2cd597a0aa5c5 -rad4eba236aac060e0713c9304aaeb5d8b1eb2236
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/HydraulicBoundaryLocationContext.cs (.../HydraulicBoundaryLocationContext.cs) (revision 0f28eb71a18af127ad376776ebd2cd597a0aa5c5)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/HydraulicBoundaryLocationContext.cs (.../HydraulicBoundaryLocationContext.cs) (revision ad4eba236aac060e0713c9304aaeb5d8b1eb2236)
@@ -33,11 +33,27 @@
///
/// Creates a new instance of .
///
- /// The
- /// which the belongs to.
- /// Thrown when
- /// is null.
- protected HydraulicBoundaryLocationContext(HydraulicBoundaryLocation wrappedData)
- : base(wrappedData) {}
+ /// The which the
+ /// belongs to.
+ /// for obtaining a
+ /// based on .
+ /// Thrown when any input parameter is null.
+ protected HydraulicBoundaryLocationContext(HydraulicBoundaryLocation wrappedData,
+ Func getCalculationFunc)
+ : base(wrappedData)
+ {
+ if (getCalculationFunc == null)
+ {
+ throw new ArgumentNullException(nameof(getCalculationFunc));
+ }
+
+ GetCalculationFunc = getCalculationFunc;
+ }
+
+ ///
+ /// Gets the for obtaining a
+ /// based on .
+ ///
+ public Func GetCalculationFunc { get; }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryLocationContextTest.cs
===================================================================
diff -u -r0f28eb71a18af127ad376776ebd2cd597a0aa5c5 -rad4eba236aac060e0713c9304aaeb5d8b1eb2236
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryLocationContextTest.cs (.../HydraulicBoundaryLocationContextTest.cs) (revision 0f28eb71a18af127ad376776ebd2cd597a0aa5c5)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryLocationContextTest.cs (.../HydraulicBoundaryLocationContextTest.cs) (revision ad4eba236aac060e0713c9304aaeb5d8b1eb2236)
@@ -31,34 +31,40 @@
public class HydraulicBoundaryLocationContextTest
{
[Test]
- public void Constructor_HydraulicBoundaryLocationNull_ThrowsArgumentNullException()
+ public void Constructor_GetCalculationFuncNull_ThrowsArgumentNullException()
{
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "Name", 2.0, 3.0);
+
// Call
- TestDelegate test = () => new TestHydraulicBoundaryLocationContext(null);
+ TestDelegate test = () => new TestHydraulicBoundaryLocationContext(hydraulicBoundaryLocation, null);
// Assert
string paramName = Assert.Throws(test).ParamName;
- Assert.AreEqual("wrappedData", paramName);
+ Assert.AreEqual("getCalculationFunc", paramName);
}
[Test]
public void Constructor_ValidParameters_ExpectedValues()
{
// Setup
var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "Name", 2.0, 3.0);
+ Func getCalculationFunc = hbl => null;
// Call
- var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryLocation);
+ var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryLocation, getCalculationFunc);
// Assert
Assert.IsInstanceOf>(context);
Assert.AreSame(hydraulicBoundaryLocation, context.WrappedData);
+ Assert.AreSame(getCalculationFunc, context.GetCalculationFunc);
}
private class TestHydraulicBoundaryLocationContext : HydraulicBoundaryLocationContext
{
- public TestHydraulicBoundaryLocationContext(HydraulicBoundaryLocation wrappedData)
- : base(wrappedData) {}
+ public TestHydraulicBoundaryLocationContext(HydraulicBoundaryLocation wrappedData,
+ Func getCalculationFunc)
+ : base(wrappedData, getCalculationFunc) {}
}
}
}
\ No newline at end of file