Index: Riskeer/Common/src/Riskeer.Common.Forms/Helpers/CalculationsDisplayNameHelper.cs =================================================================== diff -u -rf742d5fba12ab75ba892b2c73eab0faebd967335 -re5df147552db28b36146dfce7896cae15e3b187a --- Riskeer/Common/src/Riskeer.Common.Forms/Helpers/CalculationsDisplayNameHelper.cs (.../CalculationsDisplayNameHelper.cs) (revision f742d5fba12ab75ba892b2c73eab0faebd967335) +++ Riskeer/Common/src/Riskeer.Common.Forms/Helpers/CalculationsDisplayNameHelper.cs (.../CalculationsDisplayNameHelper.cs) (revision e5df147552db28b36146dfce7896cae15e3b187a) @@ -83,6 +83,40 @@ return GetUniqueDisplayNameLookup(nonUniqueWaterLevelCalculationsDisplayNameLookup)[calculations]; } + /// + /// Gets a unique wave height calculations display name for the provided . + /// + /// The assessment section the belong to. + /// The wave height calculations to get the unique display name for. + /// A unique wave height calculations display name. + /// Thrown when any input parameter is null. + /// Thrown when is not part of the wave height + /// calculations within . + public string GetUniqueDisplayNameForWaveHeightCalculations(IAssessmentSection assessmentSection, IEnumerable calculations) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (calculations == null) + { + throw new ArgumentNullException(nameof(calculations)); + } + + Dictionary nonUniqueWaveHeightCalculationsDisplayNameLookup = + assessmentSection.WaveHeightCalculationsForUserDefinedTargetProbabilities + .ToDictionary(whc => (object) whc.HydraulicBoundaryLocationCalculations, + whc => noProbabilityValueDoubleConverter.ConvertToString(whc.TargetProbability)); + + if (!nonUniqueWaveHeightCalculationsDisplayNameLookup.ContainsKey(calculations)) + { + throw new InvalidOperationException("The provided calculations object is not part of the wave height calculations within the assessment section."); + } + + return GetUniqueDisplayNameLookup(nonUniqueWaveHeightCalculationsDisplayNameLookup)[calculations]; + } + private static Dictionary GetUniqueDisplayNameLookup(IDictionary nonUniqueDisplayNameLookup) { var uniqueDisplayNameLookup = new Dictionary();