Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs =================================================================== diff -u -r30c0356e486b018532e85b0dde94efe832cf445f -r39fbcdb4cfd610d8c8dccbe1793d8f17fce156c4 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (.../ExportableAssessmentSectionTest.cs) (revision 30c0356e486b018532e85b0dde94efe832cf445f) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (.../ExportableAssessmentSectionTest.cs) (revision 39fbcdb4cfd610d8c8dccbe1793d8f17fce156c4) @@ -23,6 +23,7 @@ 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; @@ -44,6 +45,7 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(null, + "id", geometry, ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(), ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(), @@ -58,6 +60,35 @@ } [Test] + [TestCase(null)] + [TestCase("")] + [TestCase(" ")] + public void Constructor_InvalidId_ThrowsArgumentException(string invalidId) + { + // Setup + IEnumerable geometry = Enumerable.Empty(); + IEnumerable> failureMechanismsWithProbability = + Enumerable.Empty>(); + IEnumerable> failureMechanismsWithoutProbability = + Enumerable.Empty>(); + + // Call + TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + invalidId, + geometry, + ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithoutProbability(), + failureMechanismsWithProbability, + failureMechanismsWithoutProbability, + CreateCombinedSectionAssemblyCollection()); + + // Assert + const string expectedMessage = "'id' must have a value."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + } + + [Test] public void Constructor_GeometryNull_ThrowsArgumentNullException() { // Setup @@ -68,6 +99,7 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + "id", null, ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(), ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(), @@ -93,6 +125,7 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + "id", geometry, null, ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(), @@ -117,6 +150,7 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + "id", geometry, ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(), null, @@ -142,6 +176,7 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + "id", geometry, ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(), ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(), @@ -165,6 +200,7 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + "id", geometry, ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(), ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(), @@ -187,6 +223,7 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + "id", geometry, ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(), ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(), @@ -212,6 +249,7 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + "id", geometry, ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(), ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(), @@ -231,9 +269,11 @@ public void Constructor_WithValidArguments_ExpectedValues(string name) { // Setup + const string id = "Assessment section id"; + IEnumerable geometry = Enumerable.Empty(); ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = ExportableAssessmentSectionAssemblyResultTestFactory.CreateResult(); - ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyResultWithProbability = + ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyResultWithProbability = ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithProbability(); ExportableFailureMechanismAssemblyResult failureMechanismAssemblyResultWithoutProbability = ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithoutProbability(); @@ -245,6 +285,7 @@ // Call var assessmentSection = new ExportableAssessmentSection(name, + id, geometry, assessmentSectionAssembly, failureMechanismAssemblyResultWithProbability, @@ -255,6 +296,7 @@ // Assert Assert.AreEqual(name, assessmentSection.Name); + Assert.AreEqual(id, assessmentSection.Id); Assert.AreSame(geometry, assessmentSection.Geometry); Assert.AreSame(assessmentSectionAssembly, assessmentSection.AssessmentSectionAssembly); Assert.AreSame(failureMechanismAssemblyResultWithProbability, assessmentSection.FailureMechanismAssemblyWithProbability);