Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs =================================================================== diff -u -ra2ce3e55443ed38bd6d7dbc7b33ff66e5d9c0d64 -r44cf5bc0f292171637b0c91b74005effe4d2798c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision a2ce3e55443ed38bd6d7dbc7b33ff66e5d9c0d64) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 44cf5bc0f292171637b0c91b74005effe4d2798c) @@ -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; @@ -160,6 +161,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[] { @@ -326,6 +342,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)