Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs =================================================================== diff -u -r64426c8cf80aaac466ddd1112888f4d6a4b7e4ef -r0b87439aae7f9627a79e1cd315f49175ad927f1c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 64426c8cf80aaac466ddd1112888f4d6a4b7e4ef) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionView.cs (.../AssessmentSectionView.cs) (revision 0b87439aae7f9627a79e1cd315f49175ad927f1c) @@ -37,11 +37,13 @@ public partial class AssessmentSectionView : UserControl, IMapView { private readonly IAssessmentSection assessmentSection; - private readonly Observer assessmentSectionObserver; - private readonly Observer hydraulicBoundaryLocationsObserver; + private readonly MapLineData referenceLineMapData; private readonly MapPointData hydraulicBoundaryLocationsMapData; + private readonly Observer assessmentSectionObserver; + private readonly Observer hydraulicBoundaryLocationsObserver; + private readonly RecursiveObserver, HydraulicBoundaryLocationCalculation> waterLevelCalculationsForFactorizedSignalingNormObserver; private readonly RecursiveObserver, HydraulicBoundaryLocation> hydraulicBoundaryLocationObserver; /// @@ -60,6 +62,12 @@ { Observable = assessmentSection }; + waterLevelCalculationsForFactorizedSignalingNormObserver = new RecursiveObserver, HydraulicBoundaryLocationCalculation>( + UpdateMapData, calc => calc) + { + Observable = assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm + }; + hydraulicBoundaryLocationsObserver = new Observer(UpdateMapData) { Observable = assessmentSection.HydraulicBoundaryDatabase.Locations @@ -96,6 +104,7 @@ protected override void Dispose(bool disposing) { assessmentSectionObserver.Dispose(); + waterLevelCalculationsForFactorizedSignalingNormObserver.Dispose(); hydraulicBoundaryLocationsObserver.Dispose(); hydraulicBoundaryLocationObserver.Dispose(); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs =================================================================== diff -u -r64426c8cf80aaac466ddd1112888f4d6a4b7e4ef -r0b87439aae7f9627a79e1cd315f49175ad927f1c --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (.../AssessmentSectionViewTest.cs) (revision 64426c8cf80aaac466ddd1112888f4d6a4b7e4ef) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionViewTest.cs (.../AssessmentSectionViewTest.cs) (revision 0b87439aae7f9627a79e1cd315f49175ad927f1c) @@ -42,6 +42,15 @@ private const int referenceLineIndex = 0; private const int hydraulicBoundaryLocationsIndex = 1; + private static IEnumerable GetCalculations + { + get + { + yield return new TestCaseData(new Func( + assessmentSection => assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.First())); + } + } + [Test] public void Constructor_ExpectedValues() { @@ -58,8 +67,8 @@ Assert.AreEqual(1, view.Controls.Count); Assert.IsInstanceOf(view.Controls[0]); - Assert.AreSame(view.Map, ((RingtoetsMapControl)view.Controls[0]).MapControl); - Assert.AreEqual(DockStyle.Fill, ((Control)view.Map).Dock); + Assert.AreSame(view.Map, ((RingtoetsMapControl) view.Controls[0]).MapControl); + Assert.AreEqual(DockStyle.Fill, ((Control) view.Map).Dock); AssertEmptyMapData(view.Map.Data); } } @@ -74,7 +83,7 @@ var exception = Assert.Throws(call); Assert.AreEqual("assessmentSection", exception.ParamName); } - + [Test] public void Constructor_AssessmentSectionWithBackgroundData_BackgroundDataSet() { @@ -158,6 +167,35 @@ } [Test] + [TestCaseSource(nameof(GetCalculations))] + public void GivenViewWithHydraulicBoundaryLocationsData_WhenHydraulicBoundaryLocationCalculationUpdatedAndNotified_ThenMapDataUpdated( + Func getCalculationFunc) + { + // Given + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test1", 1.0, 2.0); + var assessmentSection = new ObservableTestAssessmentSectionStub(); + assessmentSection.AddHydraulicBoundaryLocation(hydraulicBoundaryLocation); + + using (var view = new AssessmentSectionView(assessmentSection)) + { + IMapControl map = ((RingtoetsMapControl) view.Controls[0]).MapControl; + + MapData hydraulicBoundaryLocationsMapData = map.Data.Collection.ElementAt(hydraulicBoundaryLocationsIndex); + + // Precondition + MapDataTestHelper.AssertHydraulicBoundaryLocationOutputsMapData(assessmentSection, hydraulicBoundaryLocationsMapData); + + // When + HydraulicBoundaryLocationCalculation calculation = getCalculationFunc(assessmentSection); + calculation.Output = new TestHydraulicBoundaryLocationOutput(new Random(21).NextDouble()); + calculation.NotifyObservers(); + + // Then + MapDataTestHelper.AssertHydraulicBoundaryLocationOutputsMapData(assessmentSection, hydraulicBoundaryLocationsMapData); + } + } + + [Test] public void GivenViewWithHydraulicBoundaryLocationsDatabase_WhenChangingHydraulicBoundaryLocationsDataAndObserversNotified_MapDataUpdated() { // Given