Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInputHelper.cs =================================================================== diff -u -r8d4b9f33c5cc447619dc028293676e78003783e3 -r5580a3f80fcb903e6f5448339013766abc2bbebd --- Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInputHelper.cs (.../WaveConditionsInputHelper.cs) (revision 8d4b9f33c5cc447619dc028293676e78003783e3) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInputHelper.cs (.../WaveConditionsInputHelper.cs) (revision 5580a3f80fcb903e6f5448339013766abc2bbebd) @@ -19,7 +19,12 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using System.ComponentModel; using Core.Common.Base.Data; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.FailureMechanism; namespace Ringtoets.Revetment.Data { @@ -40,5 +45,81 @@ { return new RoundedDouble(2, assessmentLevel - designWaterLevelSubstraction); } + + /// + /// Sets the of the + /// based on the . + /// + /// The to set. + /// The to set the for. + /// Thrown when is null. + /// Thrown when is an invalid value. + /// Thrown when is a valid value, + /// but unsupported. + public static void SetCategoryType(AssessmentSectionCategoryWaveConditionsInput waveConditionsInput, + NormType normType) + { + if (waveConditionsInput == null) + { + throw new ArgumentNullException(nameof(waveConditionsInput)); + } + + if (!Enum.IsDefined(typeof(NormType), normType)) + { + throw new InvalidEnumArgumentException(nameof(normType), + (int) normType, + typeof(NormType)); + } + + switch (normType) + { + case NormType.LowerLimit: + waveConditionsInput.CategoryType = AssessmentSectionCategoryType.LowerLimitNorm; + break; + case NormType.Signaling: + waveConditionsInput.CategoryType = AssessmentSectionCategoryType.SignalingNorm; + break; + default: + throw new NotSupportedException($"The enum value {nameof(NormType)}.{normType} is not supported."); + } + } + + /// + /// Sets the of the + /// based on the . + /// + /// The to set. + /// The to set the for. + /// Thrown when is null. + /// Thrown when is an invalid value. + /// Thrown when is a valid value, + /// but unsupported. + public static void SetCategoryType(FailureMechanismCategoryWaveConditionsInput waveConditionsInput, + NormType normType) + { + if (waveConditionsInput == null) + { + throw new ArgumentNullException(nameof(waveConditionsInput)); + } + + if (!Enum.IsDefined(typeof(NormType), normType)) + { + throw new InvalidEnumArgumentException(nameof(normType), + (int) normType, + typeof(NormType)); + } + + switch (normType) + { + case NormType.LowerLimit: + waveConditionsInput.CategoryType = FailureMechanismCategoryType.MechanismSpecificLowerLimitNorm; + break; + case NormType.Signaling: + waveConditionsInput.CategoryType = FailureMechanismCategoryType.MechanismSpecificSignalingNorm; + break; + default: + throw new NotSupportedException($"The enum value {nameof(NormType)}.{normType} is not supported."); + } + } } } \ No newline at end of file