Index: Riskeer/Common/src/Riskeer.Common.Forms/Helpers/CalculationsDisplayNameHelper.cs =================================================================== diff -u -re5df147552db28b36146dfce7896cae15e3b187a -r46f967bac33e1a987a4f2974746874d72a2800f4 --- Riskeer/Common/src/Riskeer.Common.Forms/Helpers/CalculationsDisplayNameHelper.cs (.../CalculationsDisplayNameHelper.cs) (revision e5df147552db28b36146dfce7896cae15e3b187a) +++ Riskeer/Common/src/Riskeer.Common.Forms/Helpers/CalculationsDisplayNameHelper.cs (.../CalculationsDisplayNameHelper.cs) (revision 46f967bac33e1a987a4f2974746874d72a2800f4) @@ -25,6 +25,7 @@ using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Forms.TypeConverters; +using Riskeer.DuneErosion.Data; namespace Riskeer.Common.Forms.Helpers { @@ -117,6 +118,43 @@ return GetUniqueDisplayNameLookup(nonUniqueWaveHeightCalculationsDisplayNameLookup)[calculations]; } + /// + /// Gets a unique dune location calculations display name for the provided . + /// + /// The assessment section the belong to. + /// The dune location calculations to get the unique display name for. + /// A unique dune location calculations display name. + /// Thrown when any input parameter is null. + /// Thrown when is not part of the dune location + /// calculations within . + public string GetUniqueDisplayNameForDuneLocationCalculations(IAssessmentSection assessmentSection, IEnumerable calculations) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (calculations == null) + { + throw new ArgumentNullException(nameof(calculations)); + } + + Dictionary nonUniqueDuneLocationCalculationsDisplayNameLookup = + assessmentSection.GetFailureMechanisms() + .OfType() + .First() + .DuneLocationCalculationsForUserDefinedTargetProbabilities + .ToDictionary(whc => (object) whc.DuneLocationCalculations, + whc => noProbabilityValueDoubleConverter.ConvertToString(whc.TargetProbability)); + + if (!nonUniqueDuneLocationCalculationsDisplayNameLookup.ContainsKey(calculations)) + { + throw new InvalidOperationException("The provided calculations object is not part of the dune location calculations within the assessment section."); + } + + return GetUniqueDisplayNameLookup(nonUniqueDuneLocationCalculationsDisplayNameLookup)[calculations]; + } + private static Dictionary GetUniqueDisplayNameLookup(IDictionary nonUniqueDisplayNameLookup) { var uniqueDisplayNameLookup = new Dictionary();