Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs
===================================================================
diff -u -r39fbcdb4cfd610d8c8dccbe1793d8f17fce156c4 -r73c63e47823a66cef6285ab755890e05850d7b09
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs (.../ExportableAssessmentSection.cs) (revision 39fbcdb4cfd610d8c8dccbe1793d8f17fce156c4)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs (.../ExportableAssessmentSection.cs) (revision 73c63e47823a66cef6285ab755890e05850d7b09)
@@ -48,8 +48,7 @@
/// of failure mechanisms belonging to this assessment section.
/// The combined section assembly results
/// of this assessment section.
- /// Thrown when any parameter, except is null.
- /// Thrown when is null, empty or consists only of whitespaces.
+ /// Thrown when any parameter is null.
public ExportableAssessmentSection(string name,
string id,
IEnumerable geometry,
@@ -65,9 +64,9 @@
throw new ArgumentNullException(nameof(name));
}
- if (string.IsNullOrWhiteSpace(id))
+ if (id == null)
{
- throw new ArgumentException($@"'{nameof(id)}' must have a value.", nameof(id));
+ throw new ArgumentNullException(nameof(id));
}
if (geometry == null)
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs
===================================================================
diff -u -r39fbcdb4cfd610d8c8dccbe1793d8f17fce156c4 -r73c63e47823a66cef6285ab755890e05850d7b09
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (.../ExportableAssessmentSectionTest.cs) (revision 39fbcdb4cfd610d8c8dccbe1793d8f17fce156c4)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (.../ExportableAssessmentSectionTest.cs) (revision 73c63e47823a66cef6285ab755890e05850d7b09)
@@ -23,7 +23,6 @@
using System.Collections.Generic;
using System.Linq;
using Core.Common.Base.Geometry;
-using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Integration.IO.Assembly;
using Ringtoets.Integration.IO.TestUtil;
@@ -45,7 +44,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(null,
- "id",
+ string.Empty,
geometry,
ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
@@ -60,10 +59,7 @@
}
[Test]
- [TestCase(null)]
- [TestCase("")]
- [TestCase(" ")]
- public void Constructor_InvalidId_ThrowsArgumentException(string invalidId)
+ public void Constructor_InvalidId_ThrowsArgumentException()
{
// Setup
IEnumerable geometry = Enumerable.Empty();
@@ -74,7 +70,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
- invalidId,
+ null,
geometry,
ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
@@ -84,8 +80,8 @@
CreateCombinedSectionAssemblyCollection());
// Assert
- const string expectedMessage = "'id' must have a value.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("id", exception.ParamName);
}
[Test]
@@ -99,7 +95,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
- "id",
+ string.Empty,
null,
ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
@@ -125,7 +121,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
- "id",
+ string.Empty,
geometry,
null,
ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
@@ -150,7 +146,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
- "id",
+ string.Empty,
geometry,
ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
null,
@@ -176,7 +172,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
- "id",
+ string.Empty,
geometry,
ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
@@ -200,7 +196,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
- "id",
+ string.Empty,
geometry,
ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
@@ -223,7 +219,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
- "id",
+ string.Empty,
geometry,
ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
@@ -249,7 +245,7 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
- "id",
+ string.Empty,
geometry,
ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(),
ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(),
@@ -264,13 +260,12 @@
}
[Test]
- [TestCase("")]
- [TestCase("Valid name")]
- public void Constructor_WithValidArguments_ExpectedValues(string name)
+ [TestCase("", "")]
+ [TestCase(" ", " ")]
+ [TestCase("Valid name", "Valid Id")]
+ public void Constructor_WithValidArguments_ExpectedValues(string name, string id)
{
// Setup
- const string id = "Assessment section id";
-
IEnumerable geometry = Enumerable.Empty();
ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult();
ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyResultWithProbability =