Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs (revision 3626842af8fe45995839d4bffeb820251334bc77)
@@ -0,0 +1,40 @@
+using System;
+using System.Linq;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Integration.Data;
+using Ringtoets.Integration.IO.Assembly;
+
+namespace Ringtoets.Integration.IO.Factories
+{
+ ///
+ /// Factory to create instances of
+ /// with assembly results.
+ ///
+ public static class ExportableAssessmentSectionFactory
+ {
+ ///
+ /// Creates an with assembly results
+ /// based on .
+ ///
+ /// The to create
+ /// a for.
+ /// A with assembly results.
+ /// Thrown when
+ /// is null.
+ public static ExportableAssessmentSection CreateExportableAssessmentSection(AssessmentSection assessmentSection)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ return new ExportableAssessmentSection(assessmentSection.Name,
+ assessmentSection.ReferenceLine.Points,
+ new ExportableAssessmentSectionAssemblyResult(ExportableAssemblyMethod.WBI0A1, AssessmentSectionAssemblyCategoryGroup.A),
+ Enumerable.Empty>(),
+ Enumerable.Empty>(),
+ new ExportableCombinedSectionAssemblyCollection(Enumerable.Empty(),
+ Enumerable.Empty()));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj
===================================================================
diff -u -r9377aace11d9280d2eefbe64b004517c1731a8c9 -r3626842af8fe45995839d4bffeb820251334bc77
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 9377aace11d9280d2eefbe64b004517c1731a8c9)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 3626842af8fe45995839d4bffeb820251334bc77)
@@ -36,6 +36,7 @@
+
@@ -91,5 +92,10 @@
Ringtoets.Common.Util
False
+
+ {11F1F874-45AF-43E4-8AE5-15A5C9593E28}
+ Ringtoets.Integration.Data
+ False
+
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs (revision 3626842af8fe45995839d4bffeb820251334bc77)
@@ -0,0 +1,58 @@
+using System;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Integration.Data;
+using Ringtoets.Integration.IO.Assembly;
+using Ringtoets.Integration.IO.Factories;
+
+namespace Ringtoets.Integration.IO.Test.Factories
+{
+ [TestFixture]
+ public class ExportableAssessmentSectionFactoryTest
+ {
+ [Test]
+ public void CreateExportableAssessmentSection_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ExportableAssessmentSectionFactory.CreateExportableAssessmentSection(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void CreateExportableAssessmentSection_WithAssessmentSection_ReturnsExpectedValues()
+ {
+ // Setup
+ const string name = "assessmentSectionName";
+
+ var referenceLine = new ReferenceLine();
+ referenceLine.SetGeometry(new[]
+ {
+ new Point2D(1, 1),
+ new Point2D(2, 2)
+ });
+
+ var random = new Random(21);
+ var assessmentSection = new AssessmentSection(random.NextEnumValue())
+ {
+ Name = name,
+ ReferenceLine = referenceLine
+ };
+
+ // Call
+ ExportableAssessmentSection exportableAssessmentSection = ExportableAssessmentSectionFactory.CreateExportableAssessmentSection(assessmentSection);
+
+ // Assert
+ Assert.AreEqual(name, exportableAssessmentSection.Name);
+ CollectionAssert.AreEqual(referenceLine.Points, exportableAssessmentSection.Geometry);
+ CollectionAssert.IsEmpty(exportableAssessmentSection.FailureMechanismsWithProbability);
+ CollectionAssert.IsEmpty(exportableAssessmentSection.FailureMechanismsWithoutProbability);
+ Assert.IsNotNull(exportableAssessmentSection.CombinedSectionAssemblyResults);
+ Assert.IsNotNull(exportableAssessmentSection.AssessmentSectionAssembly);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj
===================================================================
diff -u -r9377aace11d9280d2eefbe64b004517c1731a8c9 -r3626842af8fe45995839d4bffeb820251334bc77
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 9377aace11d9280d2eefbe64b004517c1731a8c9)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 3626842af8fe45995839d4bffeb820251334bc77)
@@ -1,4 +1,4 @@
-
+
{06C448C6-CBDE-4579-B5B6-1B8074E022ED}
@@ -36,6 +36,7 @@
+
@@ -79,6 +80,10 @@
{54DF6303-BF9A-4AE9-BE09-4AF50EF27412}
Ringtoets.Common.Util.TestUtil
+
+ {11F1F874-45AF-43E4-8AE5-15A5C9593E28}
+ Ringtoets.Integration.Data
+
{D693D18E-C257-4FDE-96BC-F6E6FB043ECF}
Ringtoets.Integration.IO