Index: Riskeer/Revetment/test/Riskeer.Revetment.Data.Test/WaveConditionsInputHelperTest.cs =================================================================== diff -u -r7491928192a7ecf23958f85fbd4669ec17085c95 -rdf06804d1c7938e2cc4600e12968c78b396edc07 --- Riskeer/Revetment/test/Riskeer.Revetment.Data.Test/WaveConditionsInputHelperTest.cs (.../WaveConditionsInputHelperTest.cs) (revision 7491928192a7ecf23958f85fbd4669ec17085c95) +++ Riskeer/Revetment/test/Riskeer.Revetment.Data.Test/WaveConditionsInputHelperTest.cs (.../WaveConditionsInputHelperTest.cs) (revision df06804d1c7938e2cc4600e12968c78b396edc07) @@ -27,6 +27,8 @@ using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Contribution; using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Data.TestUtil; +using Riskeer.Revetment.Data.TestUtil; namespace Riskeer.Revetment.Data.Test { @@ -56,11 +58,11 @@ var random = new Random(21); // Call - TestDelegate call = () => WaveConditionsInputHelper.SetCategoryType((AssessmentSectionCategoryWaveConditionsInput) null, - random.NextEnumValue()); + void Call() => WaveConditionsInputHelper.SetCategoryType((AssessmentSectionCategoryWaveConditionsInput) null, + random.NextEnumValue()); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(Call); Assert.AreEqual("waveConditionsInput", exception.ParamName); } @@ -71,11 +73,11 @@ const NormType normType = (NormType) 99; // Call - TestDelegate call = () => WaveConditionsInputHelper.SetCategoryType(new AssessmentSectionCategoryWaveConditionsInput(), - normType); + void Call() => WaveConditionsInputHelper.SetCategoryType(new AssessmentSectionCategoryWaveConditionsInput(), normType); + // Assert - string expectedMessage = $"The value of argument 'normType' ({(int) normType}) is invalid for Enum type '{nameof(NormType)}'."; - var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + var expectedMessage = $"The value of argument 'normType' ({(int) normType}) is invalid for Enum type '{nameof(NormType)}'."; + var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage); Assert.AreEqual("normType", exception.ParamName); } @@ -103,11 +105,11 @@ var random = new Random(21); // Call - TestDelegate call = () => WaveConditionsInputHelper.SetCategoryType((FailureMechanismCategoryWaveConditionsInput) null, - random.NextEnumValue()); + void Call() => WaveConditionsInputHelper.SetCategoryType((FailureMechanismCategoryWaveConditionsInput) null, + random.NextEnumValue()); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(Call); Assert.AreEqual("waveConditionsInput", exception.ParamName); } @@ -118,11 +120,11 @@ const NormType normType = (NormType) 99; // Call - TestDelegate call = () => WaveConditionsInputHelper.SetCategoryType(new FailureMechanismCategoryWaveConditionsInput(), - normType); + void Call() => WaveConditionsInputHelper.SetCategoryType(new FailureMechanismCategoryWaveConditionsInput(), normType); + // Assert - string expectedMessage = $"The value of argument 'normType' ({(int) normType}) is invalid for Enum type '{nameof(NormType)}'."; - var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + var expectedMessage = $"The value of argument 'normType' ({(int) normType}) is invalid for Enum type '{nameof(NormType)}'."; + var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage); Assert.AreEqual("normType", exception.ParamName); } @@ -142,5 +144,49 @@ // Assert Assert.AreEqual(expectedFailureMechanismCategoryType, waveConditionsInput.CategoryType); } + + [Test] + public void GetTargetProbability_InputNull_ThrowsArgumentNullException() + { + // Call + void Call() => WaveConditionsInputHelper.GetTargetProbability(null, new AssessmentSectionStub()); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("input", exception.ParamName); + } + + [Test] + public void GetTargetProbability_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + void Call() => WaveConditionsInputHelper.GetTargetProbability(new TestWaveConditionsInput(), null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + + [Test] + public void GetAssessmentLevel_InputNull_ThrowsArgumentNullException() + { + // Call + void Call() => WaveConditionsInputHelper.GetAssessmentLevel(null, new AssessmentSectionStub()); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("input", exception.ParamName); + } + + [Test] + public void GetAssessmentLevel_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + void Call() => WaveConditionsInputHelper.GetAssessmentLevel(new TestWaveConditionsInput(), null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } } } \ No newline at end of file