Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Properties/Resources.Designer.cs =================================================================== diff -u -r8d42f78b73ab49db2934de47d82664ea0a1f2458 -r61d40fcfe715efa13eeeaec3f89b59d0e01b10b4 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8d42f78b73ab49db2934de47d82664ea0a1f2458) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 61d40fcfe715efa13eeeaec3f89b59d0e01b10b4) @@ -118,6 +118,15 @@ } /// + /// Looks up a localized string similar to De waarde voor aantal nivelleringen per jaar moet groter of gelijk zijn aan 0.. + /// + public static string StabilityPointStructuresInput_LevellingCount_must_be_equal_or_greater_to_zero { + get { + return ResourceManager.GetString("StabilityPointStructuresInput_LevellingCount_must_be_equal_or_greater_to_zero", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De waarde voor afstand onderkant wand en teen dijk moet groter of gelijk zijn aan 0.. /// public static string StabilityPointStructuresInput_VerticalDistance_must_be_equal_or_greater_to_zero { Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Properties/Resources.resx =================================================================== diff -u -r8d42f78b73ab49db2934de47d82664ea0a1f2458 -r61d40fcfe715efa13eeeaec3f89b59d0e01b10b4 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Properties/Resources.resx (.../Resources.resx) (revision 8d42f78b73ab49db2934de47d82664ea0a1f2458) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Properties/Resources.resx (.../Resources.resx) (revision 61d40fcfe715efa13eeeaec3f89b59d0e01b10b4) @@ -132,4 +132,7 @@ De waarde voor afstand onderkant wand en teen dijk moet groter of gelijk zijn aan 0. + + De waarde voor aantal nivelleringen per jaar moet groter of gelijk zijn aan 0. + \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs =================================================================== diff -u -r8d42f78b73ab49db2934de47d82664ea0a1f2458 -r61d40fcfe715efa13eeeaec3f89b59d0e01b10b4 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs (.../StabilityPointStructuresInput.cs) (revision 8d42f78b73ab49db2934de47d82664ea0a1f2458) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs (.../StabilityPointStructuresInput.cs) (revision 61d40fcfe715efa13eeeaec3f89b59d0e01b10b4) @@ -39,6 +39,8 @@ private static readonly Range verticalDistanceValidityRange = new Range( new RoundedDouble(verticalDistanceNumberOfDecimals), new RoundedDouble(verticalDistanceNumberOfDecimals, double.PositiveInfinity)); + private static readonly Range levellingCountValidityRange = new Range(0, int.MaxValue); + private NormalDistribution insideWaterLevelFailureConstruction; private NormalDistribution insideWaterLevel; private NormalDistribution drainCoefficient; @@ -60,6 +62,7 @@ private RoundedDouble verticalDistance; private double failureProbabilityRepairClosure; private double probabilityCollisionSecondaryStructure; + private int levellingCount; /// /// Creates a new instance of . @@ -603,7 +606,24 @@ /// Gets or sets the levelling count. /// [1/year] /// - public int LevellingCount { get; set; } + /// + /// Thrown when the value is smaller then 0. + public int LevellingCount + { + get + { + return levellingCount; + } + set + { + if (!levellingCountValidityRange.InRange(value)) + { + throw new ArgumentOutOfRangeException(nameof(LevellingCount), + Resources.StabilityPointStructuresInput_LevellingCount_must_be_equal_or_greater_to_zero); + } + levellingCount = value; + } + } /// /// Gets or sets the probability of a secondary collision on the structure per levelling. Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs =================================================================== diff -u -r8d42f78b73ab49db2934de47d82664ea0a1f2458 -r61d40fcfe715efa13eeeaec3f89b59d0e01b10b4 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision 8d42f78b73ab49db2934de47d82664ea0a1f2458) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision 61d40fcfe715efa13eeeaec3f89b59d0e01b10b4) @@ -992,6 +992,35 @@ call, "De waarde voor afstand onderkant wand en teen dijk moet groter of gelijk zijn aan 0."); } + [Test] + public void LevellingCount_ValidValue_ExpectedValues() + { + // Setup + var input = new StabilityPointStructuresInput(); + int levellingCount = new Random(21).Next(0, int.MaxValue); + + // Call + input.LevellingCount = levellingCount; + + // Assert + Assert.AreEqual(levellingCount, input.LevellingCount); + } + + [Test] + public void LevellingCount_InvalidValue_ThrowsArgumentOutOfRangException() + { + // Setup + var input = new StabilityPointStructuresInput(); + + // Call + TestDelegate call = () => input.LevellingCount = -1; + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage( + call, "De waarde voor aantal nivelleringen per jaar moet groter of gelijk zijn aan 0."); + } + + #endregion #region Helpers