Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs =================================================================== diff -u -r686c5eeaad900a6bb627733de8c21bd607f130aa -rd236ecbbb507886199e326a205ef633576e0b5c3 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs (.../CalculatorInputAssert.cs) (revision 686c5eeaad900a6bb627733de8c21bd607f130aa) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs (.../CalculatorInputAssert.cs) (revision d236ecbbb507886199e326a205ef633576e0b5c3) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.ComponentModel; using System.Linq; using NUnit.Framework; @@ -39,6 +40,10 @@ /// The actual . /// Thrown when /// does not correspond to . + /// Thrown when + /// contains an invalid value of the enum . + /// Thrown when + /// contains an unsupported value of . public static void AssertSoilProfile(IMacroStabilityInwardsSoilProfileUnderSurfaceLine original, SoilProfile actual) { MacroStabilityInwardsSoilLayer2D[] expectedLayers = original.Layers.ToArray(); @@ -104,8 +109,12 @@ /// /// The original array. /// The actual array. - /// Thrown when + /// Thrown when /// does not correspond to . + /// Thrown when + /// contains an item with an invalid value of the enum . + /// Thrown when + /// contains an item with an unsupported value of . private static void AssertLayers(MacroStabilityInwardsSoilLayer2D[] original, SoilLayer[] actual) { Assert.AreEqual(original.Length, actual.Length); @@ -140,9 +149,18 @@ /// The original shear strength model /// A converted shear strength model /// Thrown when - /// is an invalid value. + /// is an invalid value of the enum . + /// Thrown when + /// is an unsupported value. private static ShearStrengthModel ConvertShearStrengthModel(MacroStabilityInwardsShearStrengthModel shearStrengthModel) { + if (!Enum.IsDefined(typeof(MacroStabilityInwardsShearStrengthModel), shearStrengthModel)) + { + throw new InvalidEnumArgumentException(nameof(shearStrengthModel), + (int) shearStrengthModel, + typeof(MacroStabilityInwardsShearStrengthModel)); + } + switch (shearStrengthModel) { case MacroStabilityInwardsShearStrengthModel.SuCalculated: @@ -152,7 +170,7 @@ case MacroStabilityInwardsShearStrengthModel.CPhiOrSuCalculated: return ShearStrengthModel.CPhiOrSuCalculated; default: - throw new InvalidEnumArgumentException(); + throw new NotSupportedException(); } } }