Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs (revision 719d0e6a2b96f912e844a16cfc96c4f7c8da62b7) @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using Core.Common.Base.Geometry; + +namespace Ringtoets.Integration.IO.Assembly +{ + /// + /// Class that holds all the information to export the assembly results + /// of an assessment section. + /// + public class ExportableAssessmentSection + { + /// + /// Creates an instance of . + /// + /// The name of the assessment section. + /// The geometry of the assessment section. + /// The assembly result of the assessment section. + /// The assembly results with probability of failure + /// mechanisms belonging to this assessment section. + /// The assembly results without probability + /// of failure mechanisms belonging to this assessment section. + /// The combined section assembly results + /// of this assessment section. + /// Thrown when any parameter is null. + public ExportableAssessmentSection( + string name, + IEnumerable geometry, + ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly, + IEnumerable> failureMechanismsWithProbability, + IEnumerable> failureMechanismsWithoutProbability, + IEnumerable combinedSectionAssemblyResults) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + if (geometry == null) + { + throw new ArgumentNullException(nameof(geometry)); + } + + if (assessmentSectionAssembly == null) + { + throw new ArgumentNullException(nameof(assessmentSectionAssembly)); + } + + if (failureMechanismsWithProbability == null) + { + throw new ArgumentNullException(nameof(failureMechanismsWithProbability)); + } + + if (failureMechanismsWithoutProbability == null) + { + throw new ArgumentNullException(nameof(failureMechanismsWithoutProbability)); + } + + if (combinedSectionAssemblyResults == null) + { + throw new ArgumentNullException(nameof(combinedSectionAssemblyResults)); + } + + Name = name; + Geometry = geometry; + AssessmentSectionAssembly = assessmentSectionAssembly; + FailureMechanismsWithProbability = failureMechanismsWithProbability; + FailureMechanismsWithoutProbability = failureMechanismsWithoutProbability; + CombinedSectionAssemblyResults = combinedSectionAssemblyResults; + } + + /// + /// Gets the name of the assessment section. + /// + public string Name { get; } + + /// + /// Gets the geometry of the assessment section. + /// + public IEnumerable Geometry { get; } + + /// + /// Gets the assembly result of the assessment section. + /// + public ExportableAssessmentSectionAssemblyResult AssessmentSectionAssembly { get; } + + /// + /// Gets the collection of assembly results with probability of failure mechanisms belonging to this assessment section. + /// + public IEnumerable> FailureMechanismsWithProbability { get; } + + /// + /// Gets the collection of assembly results without probabiliyt of failure mechanisms belonging to this assessment section. + /// + public IEnumerable> FailureMechanismsWithoutProbability { get; } + + /// + /// Gets the collection of combined section assembly results of this assessment section. + /// + public IEnumerable CombinedSectionAssemblyResults { get; } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj =================================================================== diff -u -rab7637423891ead19190ff8be30751f23c7b31d4 -r719d0e6a2b96f912e844a16cfc96c4f7c8da62b7 --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision ab7637423891ead19190ff8be30751f23c7b31d4) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 719d0e6a2b96f912e844a16cfc96c4f7c8da62b7) @@ -17,6 +17,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (revision 719d0e6a2b96f912e844a16cfc96c4f7c8da62b7) @@ -0,0 +1,196 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base.Geometry; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.Integration.IO.Assembly; + +namespace Ringtoets.Integration.IO.Test.Assembly +{ + [TestFixture] + public class ExportableAssessmentSectionTest + { + [Test] + public void Constructor_NameNull_ThrowsArgumentNullException() + { + // Setup + IEnumerable geometry = Enumerable.Empty(); + ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly(); + IEnumerable> failureMechanismsWithProbability = + Enumerable.Empty>(); + IEnumerable> failureMechanismsWithoutProbability = + Enumerable.Empty>(); + IEnumerable combinedSectionAssemblyResults = Enumerable.Empty(); + + // Call + TestDelegate call = () => new ExportableAssessmentSection(null, + geometry, + assessmentSectionAssembly, + failureMechanismsWithProbability, + failureMechanismsWithoutProbability, + combinedSectionAssemblyResults); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("name", exception.ParamName); + } + + [Test] + public void Constructor_GeometryNull_ThrowsArgumentNullException() + { + // Setup + ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly(); + IEnumerable> failureMechanismsWithProbability = + Enumerable.Empty>(); + IEnumerable> failureMechanismsWithoutProbability = + Enumerable.Empty>(); + IEnumerable combinedSectionAssemblyResults = Enumerable.Empty(); + + // Call + TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + null, + assessmentSectionAssembly, + failureMechanismsWithProbability, + failureMechanismsWithoutProbability, + combinedSectionAssemblyResults); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("geometry", exception.ParamName); + } + + [Test] + public void Constructor_AssessmentSectionAssemblyNull_ThrowsArgumentNullException() + { + // Setup + IEnumerable geometry = Enumerable.Empty(); + IEnumerable> failureMechanismsWithProbability = + Enumerable.Empty>(); + IEnumerable> failureMechanismsWithoutProbability = + Enumerable.Empty>(); + IEnumerable combinedSectionAssemblyResults = Enumerable.Empty(); + + // Call + TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + geometry, + null, + failureMechanismsWithProbability, + failureMechanismsWithoutProbability, + combinedSectionAssemblyResults); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSectionAssembly", exception.ParamName); + } + + [Test] + public void Constructor_FailureMechanismsWithProbabilityNull_ThrowsArgumentNullException() + { + // Setup + IEnumerable geometry = Enumerable.Empty(); + ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly(); + IEnumerable> failureMechanismsWithoutProbability = + Enumerable.Empty>(); + IEnumerable combinedSectionAssemblyResults = Enumerable.Empty(); + + // Call + TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + geometry, + assessmentSectionAssembly, + null, + failureMechanismsWithoutProbability, + combinedSectionAssemblyResults); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanismsWithProbability", exception.ParamName); + } + + [Test] + public void Constructor_FailureMechanismsWithoutProbabilityNull_ThrowsArgumentNullException() + { + // Setup + IEnumerable geometry = Enumerable.Empty(); + ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly(); + IEnumerable> failureMechanismsWithProbability = + Enumerable.Empty>(); + IEnumerable combinedSectionAssemblyResults = Enumerable.Empty(); + + // Call + TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + geometry, + assessmentSectionAssembly, + failureMechanismsWithProbability, + null, + combinedSectionAssemblyResults); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanismsWithoutProbability", exception.ParamName); + } + + [Test] + public void Constructor_CombinedSectionAssemblyResultsNull_ThrowsArgumentNullException() + { + // Setup + IEnumerable geometry = Enumerable.Empty(); + ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly(); + IEnumerable> failureMechanismsWithProbability = + Enumerable.Empty>(); + IEnumerable> failureMechanismsWithoutProbability = + Enumerable.Empty>(); + + // Call + TestDelegate call = () => new ExportableAssessmentSection(string.Empty, + geometry, + assessmentSectionAssembly, + failureMechanismsWithProbability, + failureMechanismsWithoutProbability, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("combinedSectionAssemblyResults", exception.ParamName); + } + + [Test] + [TestCase("")] + [TestCase("Valid name")] + public void Constructor_ExpectedValues(string name) + { + // Setup + IEnumerable geometry = Enumerable.Empty(); + ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly(); + IEnumerable> failureMechanismsWithProbability = + Enumerable.Empty>(); + IEnumerable> failureMechanismsWithoutProbability = + Enumerable.Empty>(); + IEnumerable combinedSectionAssemblyResults = Enumerable.Empty(); + + // Call + var assessmentSection = new ExportableAssessmentSection(name, + geometry, + assessmentSectionAssembly, + failureMechanismsWithProbability, + failureMechanismsWithoutProbability, + combinedSectionAssemblyResults); + + // Assert + Assert.AreEqual(name, assessmentSection.Name); + Assert.AreSame(geometry, assessmentSection.Geometry); + Assert.AreSame(assessmentSectionAssembly, assessmentSection.AssessmentSectionAssembly); + Assert.AreSame(failureMechanismsWithProbability, assessmentSection.FailureMechanismsWithProbability); + Assert.AreSame(failureMechanismsWithoutProbability, assessmentSection.FailureMechanismsWithoutProbability); + Assert.AreSame(combinedSectionAssemblyResults, assessmentSection.CombinedSectionAssemblyResults); + } + + private static ExportableAssessmentSectionAssemblyResult CreateAssessmentSectionAssembly() + { + var random = new Random(21); + return new ExportableAssessmentSectionAssemblyResult(random.NextEnumValue(), + random.NextEnumValue()); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj =================================================================== diff -u -rab7637423891ead19190ff8be30751f23c7b31d4 -r719d0e6a2b96f912e844a16cfc96c4f7c8da62b7 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision ab7637423891ead19190ff8be30751f23c7b31d4) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 719d0e6a2b96f912e844a16cfc96c4f7c8da62b7) @@ -22,6 +22,7 @@ +