Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableSectionAssemblyResultFactory.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableSectionAssemblyResultFactory.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableSectionAssemblyResultFactory.cs (revision 85059e781f7f4982909f6acf6fca8bc6c618434c) @@ -0,0 +1,36 @@ +using System; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.Integration.IO.Assembly; + +namespace Ringtoets.Integration.IO.Factories +{ + /// + /// Factory to create instances of . + /// + public static class ExportableSectionAssemblyResultFactory + { + /// + /// Creates an instance of + /// based on the . + /// + /// + /// The assembly method + /// which was used to generate the result. + /// A . + /// Thrown when + /// is null. + public static ExportableSectionAssemblyResultWithProbability CreateExportableSectionAssemblyResultWithProbability( + FailureMechanismSectionAssembly failureMechanismSectionAssembly, + ExportableAssemblyMethod assemblyMethod) + { + if (failureMechanismSectionAssembly == null) + { + throw new ArgumentNullException(nameof(failureMechanismSectionAssembly)); + } + + return new ExportableSectionAssemblyResultWithProbability(assemblyMethod, + failureMechanismSectionAssembly.Group, + failureMechanismSectionAssembly.Probability); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj =================================================================== diff -u -ra2ea180503092e239c6919517c536ce1d30db295 -r85059e781f7f4982909f6acf6fca8bc6c618434c --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision a2ea180503092e239c6919517c536ce1d30db295) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 85059e781f7f4982909f6acf6fca8bc6c618434c) @@ -39,6 +39,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableSectionAssemblyResultFactoryTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableSectionAssemblyResultFactoryTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableSectionAssemblyResultFactoryTest.cs (revision 85059e781f7f4982909f6acf6fca8bc6c618434c) @@ -0,0 +1,47 @@ +using System; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.Integration.IO.Assembly; +using Ringtoets.Integration.IO.Factories; + +namespace Ringtoets.Integration.IO.Test.Factories +{ + [TestFixture] + public class ExportableSectionAssemblyResultFactoryTest + { + [Test] + public void CreateExportableSectionAssemblyResultWithProbability_FailureMechanismSectionAssemblyNull_ThrowsArgumentNullException() + { + // Setiup + var random = new Random(21); + var assemblyMethod = random.NextEnumValue(); + + // Call + TestDelegate call = () => ExportableSectionAssemblyResultFactory.CreateExportableSectionAssemblyResultWithProbability(null, assemblyMethod); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanismSectionAssembly", exception.ParamName); + } + + [Test] + public void CreateExportableSectionAssemblyResultWithProbability_WithFailureMechanismAssembly_ReturnsExportableAssemblyResultWithProbability() + { + // Setup + var random = new Random(21); + var assembly = new FailureMechanismSectionAssembly(random.NextDouble(), + random.NextEnumValue()); + var assemblyMethod = random.NextEnumValue(); + + // Call + ExportableSectionAssemblyResultWithProbability exportableAssemblyResult = + ExportableSectionAssemblyResultFactory.CreateExportableSectionAssemblyResultWithProbability(assembly, assemblyMethod); + + // Assert + Assert.AreEqual(assembly.Group, exportableAssemblyResult.AssemblyCategory); + Assert.AreEqual(assembly.Probability, exportableAssemblyResult.Probability); + Assert.AreEqual(assemblyMethod, exportableAssemblyResult.AssemblyMethod); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj =================================================================== diff -u -ra2ea180503092e239c6919517c536ce1d30db295 -r85059e781f7f4982909f6acf6fca8bc6c618434c --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision a2ea180503092e239c6919517c536ce1d30db295) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 85059e781f7f4982909f6acf6fca8bc6c618434c) @@ -41,6 +41,7 @@ +