Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationsView.cs =================================================================== diff -u -r61ec7f61542fbcb75392332755c5770ecea8d3a5 -r3ec1b0d4ff7f42b7dbdd0b15fb17e80886e6cfd6 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationsView.cs (.../HydraulicBoundaryLocationsView.cs) (revision 61ec7f61542fbcb75392332755c5770ecea8d3a5) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationsView.cs (.../HydraulicBoundaryLocationsView.cs) (revision 3ec1b0d4ff7f42b7dbdd0b15fb17e80886e6cfd6) @@ -39,24 +39,33 @@ public abstract partial class HydraulicBoundaryLocationsView : LocationsView { private readonly ObservableList locations; - private readonly Observer hydraulicBoundaryLocationsObserver; private readonly RecursiveObserver, HydraulicBoundaryLocation> hydraulicBoundaryLocationObserver; + protected readonly Func getCalculationFunc; + /// /// Creates a new instance of . /// /// The locations to show in the view. + /// for obtaining a + /// based on . /// The assessment section which the locations belong to. - /// Thrown when or - /// is null. + /// Thrown when any input parameter is null. protected HydraulicBoundaryLocationsView(ObservableList locations, + Func getCalculationFunc, IAssessmentSection assessmentSection) { if (locations == null) { throw new ArgumentNullException(nameof(locations)); } + + if (getCalculationFunc == null) + { + throw new ArgumentNullException(nameof(getCalculationFunc)); + } + if (assessmentSection == null) { throw new ArgumentNullException(nameof(assessmentSection)); @@ -68,6 +77,7 @@ hydraulicBoundaryLocationObserver = new RecursiveObserver, HydraulicBoundaryLocation>(HandleHydraulicBoundaryLocationUpdate, list => list); this.locations = locations; + this.getCalculationFunc = getCalculationFunc; hydraulicBoundaryLocationsObserver.Observable = locations; hydraulicBoundaryLocationObserver.Observable = locations; Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs =================================================================== diff -u -r2727a1b14c88e51e91add7e7cf80c5a1b5ba36d5 -r3ec1b0d4ff7f42b7dbdd0b15fb17e80886e6cfd6 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs (.../HydraulicBoundaryLocationsViewTest.cs) (revision 2727a1b14c88e51e91add7e7cf80c5a1b5ba36d5) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs (.../HydraulicBoundaryLocationsViewTest.cs) (revision 3ec1b0d4ff7f42b7dbdd0b15fb17e80886e6cfd6) @@ -71,10 +71,25 @@ } [Test] + public void Constructor_GetCalculationFuncNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new TestHydraulicBoundaryLocationsView(new ObservableList(), + null, + new ObservableTestAssessmentSectionStub()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("getCalculationFunc", exception.ParamName); + } + + [Test] public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new TestHydraulicBoundaryLocationsView(new ObservableList(), null); + TestDelegate call = () => new TestHydraulicBoundaryLocationsView(new ObservableList(), + hbl => new HydraulicBoundaryLocationCalculation(), + null); // Assert var exception = Assert.Throws(call); @@ -293,11 +308,16 @@ private sealed class TestHydraulicBoundaryLocationsView : HydraulicBoundaryLocationsView { public TestHydraulicBoundaryLocationsView(ObservableList locations) - : base(locations, new ObservableTestAssessmentSectionStub()) {} + : base(locations, + hbl => new HydraulicBoundaryLocationCalculation(), + new ObservableTestAssessmentSectionStub()) {} public TestHydraulicBoundaryLocationsView(ObservableList locations, + Func getCalculationFunc, IAssessmentSection assessmentSection) - : base(locations, assessmentSection) {} + : base(locations, + getCalculationFunc, + assessmentSection) {} public HydraulicBoundaryLocation GetCalculationsCallArgument { get; private set; }