Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs =================================================================== diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -r974fb1eadbd8a630c7a992648ad42ac85ec205b1 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs (.../HeightStructuresInput.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs (.../HeightStructuresInput.cs) (revision 974fb1eadbd8a630c7a992648ad42ac85ec205b1) @@ -32,6 +32,11 @@ /// public class HeightStructuresInput : StructuresInputBase { + private const int deviationWaveDirectionNumberOfDecimals = 2; + + private static readonly Range deviationWaveDirectionValidityRage = new Range(new RoundedDouble(deviationWaveDirectionNumberOfDecimals, -360), + new RoundedDouble(deviationWaveDirectionNumberOfDecimals, 360)); + private readonly NormalDistribution levelCrestStructure; private RoundedDouble deviationWaveDirection; @@ -41,7 +46,7 @@ public HeightStructuresInput() { levelCrestStructure = new NormalDistribution(2); - deviationWaveDirection = new RoundedDouble(2); + deviationWaveDirection = new RoundedDouble(deviationWaveDirectionNumberOfDecimals); SetDefaultSchematizationProperties(); } @@ -61,9 +66,10 @@ set { RoundedDouble newDeviationWaveDirection = value.ToPrecision(deviationWaveDirection.NumberOfDecimalPlaces); - if (!double.IsNaN(newDeviationWaveDirection) && (Math.Abs(newDeviationWaveDirection) > 360)) + if (!double.IsNaN(newDeviationWaveDirection) && !deviationWaveDirectionValidityRage.InRange(newDeviationWaveDirection)) { - throw new ArgumentOutOfRangeException(nameof(value), RingtoetsCommonDataResources.DeviationWaveDirection_Value_needs_to_be_between_negative_360_and_positive_360); + throw new ArgumentOutOfRangeException(nameof(value), string.Format(RingtoetsCommonDataResources.DeviationWaveDirection_Value_needs_to_be_in_Range_0_, + deviationWaveDirectionValidityRage)); } deviationWaveDirection = newDeviationWaveDirection; }