Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapFeaturesTestHelper.cs =================================================================== diff -u -r1f4fbcc980a70c87598d3c9be642e3e8934173ca -r64426c8cf80aaac466ddd1112888f4d6a4b7e4ef --- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapFeaturesTestHelper.cs (.../MapFeaturesTestHelper.cs) (revision 1f4fbcc980a70c87598d3c9be642e3e8934173ca) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapFeaturesTestHelper.cs (.../MapFeaturesTestHelper.cs) (revision 64426c8cf80aaac466ddd1112888f4d6a4b7e4ef) @@ -20,9 +20,11 @@ // All rights reserved. using System.Collections.Generic; +using System.Linq; using Core.Common.Base.Data; using Core.Components.Gis.Features; using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Hydraulics; namespace Ringtoets.Common.Forms.TestUtil @@ -59,6 +61,45 @@ Assert.AreEqual(expectedValue, feature.MetaData[key]); } + public static void AssertHydraulicBoundaryFeaturesData(IAssessmentSection assessmentSection, IEnumerable features) + { + HydraulicBoundaryLocation[] hydraulicBoundaryLocationsArray = assessmentSection.HydraulicBoundaryDatabase.Locations.ToArray(); + int expectedNrOfFeatures = hydraulicBoundaryLocationsArray.Length; + Assert.AreEqual(expectedNrOfFeatures, features.Count()); + + for (var i = 0; i < expectedNrOfFeatures; i++) + { + HydraulicBoundaryLocation hydraulicBoundaryLocation = hydraulicBoundaryLocationsArray[i]; + MapFeature mapFeature = features.ElementAt(i); + + AssertHydraulicBoundaryLocationOutputMetaData( + GetExpectedResult(assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm, hydraulicBoundaryLocation), + mapFeature, "h(A+->A)"); + AssertHydraulicBoundaryLocationOutputMetaData( + GetExpectedResult(assessmentSection.WaterLevelCalculationsForSignalingNorm, hydraulicBoundaryLocation), + mapFeature, "h(A->B)"); + AssertHydraulicBoundaryLocationOutputMetaData( + GetExpectedResult(assessmentSection.WaterLevelCalculationsForLowerLimitNorm, hydraulicBoundaryLocation), + mapFeature, "h(B->C)"); + AssertHydraulicBoundaryLocationOutputMetaData( + GetExpectedResult(assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm, hydraulicBoundaryLocation), + mapFeature, "h(C->D)"); + + AssertHydraulicBoundaryLocationOutputMetaData( + GetExpectedResult(assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm, hydraulicBoundaryLocation), + mapFeature, "Hs(A+->A)"); + AssertHydraulicBoundaryLocationOutputMetaData( + GetExpectedResult(assessmentSection.WaveHeightCalculationsForSignalingNorm, hydraulicBoundaryLocation), + mapFeature, "Hs(A->B)"); + AssertHydraulicBoundaryLocationOutputMetaData( + GetExpectedResult(assessmentSection.WaveHeightCalculationsForLowerLimitNorm, hydraulicBoundaryLocation), + mapFeature, "Hs(B->C)"); + AssertHydraulicBoundaryLocationOutputMetaData( + GetExpectedResult(assessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm, hydraulicBoundaryLocation), + mapFeature, "Hs(C->D)"); + } + } + /// /// Asserts whether the meta data for in /// contains the correct output data. @@ -78,5 +119,14 @@ { Assert.AreEqual(expectedValue, feature.MetaData[key]); } + + private static RoundedDouble GetExpectedResult(IEnumerable calculationList, + HydraulicBoundaryLocation hydraulicBoundaryLocation1) + { + return calculationList + .Where(calculation => calculation.HydraulicBoundaryLocation.Equals(hydraulicBoundaryLocation1)) + .Select(calculation => calculation.Output?.Result ?? RoundedDouble.NaN) + .Single(); + } } } \ No newline at end of file