Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs =================================================================== diff -u -r0eddea1a45f0d9efb0a2a12e90eb99e814d1becb -re5c50bb83746132c8263dc016f768197f83c33c5 --- Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs (.../AssessmentSectionExtensions.cs) (revision 0eddea1a45f0d9efb0a2a12e90eb99e814d1becb) +++ Ringtoets/Common/src/Ringtoets.Common.Data/AssessmentSection/AssessmentSectionExtensions.cs (.../AssessmentSectionExtensions.cs) (revision e5c50bb83746132c8263dc016f768197f83c33c5) @@ -89,6 +89,58 @@ } /// + /// Gets the normative for a . + /// + /// The assessment section to get the from. + /// The hydraulic boundary location to get the normative + /// for. + /// The normative or null when: + /// + /// is null; + /// is not part of ; + /// contains no corresponding calculation. + /// + /// + /// Thrown when + /// is null. + /// Thrown when + /// contains an invalid value of . + /// Thrown when + /// contains a valid value of , but unsupported. + public static HydraulicBoundaryLocationCalculation GetNormativeHydraulicBoundaryLocationCalculation(this IAssessmentSection assessmentSection, + HydraulicBoundaryLocation hydraulicBoundaryLocation) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + NormType normType = assessmentSection.FailureMechanismContribution.NormativeNorm; + + if (!Enum.IsDefined(typeof(NormType), normType)) + { + throw new InvalidEnumArgumentException(nameof(normType), + (int)normType, + typeof(NormType)); + } + + IEnumerable calculations; + switch (normType) + { + case NormType.Signaling: + calculations = assessmentSection.WaterLevelCalculationsForSignalingNorm; + break; + case NormType.LowerLimit: + calculations = assessmentSection.WaterLevelCalculationsForLowerLimitNorm; + break; + default: + throw new NotSupportedException(); + } + + return GetHydraulicBoundaryLocationCalculationFromCalculations(hydraulicBoundaryLocation, calculations); + } + + /// /// Gets the assessment level for a based on . /// /// The assessment section to get the assessment level from.