Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs =================================================================== diff -u -rf432893149ee8f4e74d4c21f082974fb89916150 -rca0345432ea951a80e3e956a8d485840c0897e1d --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision f432893149ee8f4e74d4c21f082974fb89916150) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision ca0345432ea951a80e3e956a8d485840c0897e1d) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Core.Common.Base; using Core.Common.Base.Geometry; @@ -153,6 +154,21 @@ } [Test] + public void Constructor_InvalidAssessmentSectionComposition_ThrowsInvalidEnumArgumentException() + { + // Setup + const int invalidValue = 99; + + // Call + TestDelegate call = () => new AssessmentSection((AssessmentSectionComposition) invalidValue); + + // Assert + string expectedMessage = $"The value of argument 'newComposition' ({invalidValue}) is invalid for Enum type '{nameof(AssessmentSectionComposition)}'."; + string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage).ParamName; + Assert.AreEqual("newComposition", parameterName); + } + + [Test] [TestCaseSource(nameof(GetInvalidNormValues), new object[] { @@ -319,6 +335,22 @@ } [Test] + public void ChangeComposition_InvalidAssessmentSectionComposition_ThrowsInvalidEnumArgumentException() + { + // Setup + const int invalidValue = 99; + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + + // Call + TestDelegate call = () => assessmentSection.ChangeComposition((AssessmentSectionComposition) invalidValue); + + // Assert + string expectedMessage = $"The value of argument 'newComposition' ({invalidValue}) is invalid for Enum type '{nameof(AssessmentSectionComposition)}'."; + string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage).ParamName; + Assert.AreEqual("newComposition", parameterName); + } + + [Test] [TestCaseSource(nameof(GetFailureMechanismRelevancy))] public void ChangeComposition_ToTargetValue_UpdateContributionsAndFailureMechanismRelevancies(AssessmentSectionComposition composition, bool[] relevancies)