Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs =================================================================== diff -u -r3626842af8fe45995839d4bffeb820251334bc77 -r38dc28e4feb88ad7d1f12b77d90d24de0bfa2663 --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs (.../ExportableAssessmentSectionFactory.cs) (revision 3626842af8fe45995839d4bffeb820251334bc77) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs (.../ExportableAssessmentSectionFactory.cs) (revision 38dc28e4feb88ad7d1f12b77d90d24de0bfa2663) @@ -1,7 +1,8 @@ -using System; +using System; using System.Linq; -using Ringtoets.AssemblyTool.Data; +using Ringtoets.Common.Data.Exceptions; using Ringtoets.Integration.Data; +using Ringtoets.Integration.Data.Assembly; using Ringtoets.Integration.IO.Assembly; namespace Ringtoets.Integration.IO.Factories @@ -21,6 +22,8 @@ /// A with assembly results. /// Thrown when /// is null. + /// Thrown when assembly results cannot be created + /// for . public static ExportableAssessmentSection CreateExportableAssessmentSection(AssessmentSection assessmentSection) { if (assessmentSection == null) @@ -30,11 +33,26 @@ return new ExportableAssessmentSection(assessmentSection.Name, assessmentSection.ReferenceLine.Points, - new ExportableAssessmentSectionAssemblyResult(ExportableAssemblyMethod.WBI0A1, AssessmentSectionAssemblyCategoryGroup.A), + CreateExportableAssessmentSectionAssemblyResult(assessmentSection), Enumerable.Empty>(), Enumerable.Empty>(), new ExportableCombinedSectionAssemblyCollection(Enumerable.Empty(), Enumerable.Empty())); } + + /// + /// Creates a with the assembly result + /// based on . + /// + /// The assessment section to create a + /// for. + /// A with assembly results. + /// Thrown when assembly results cannot be created + /// for . + private static ExportableAssessmentSectionAssemblyResult CreateExportableAssessmentSectionAssemblyResult(AssessmentSection assessmentSection) + { + return new ExportableAssessmentSectionAssemblyResult(ExportableAssemblyMethod.WBI2C1, + AssessmentSectionAssemblyFactory.AssembleAssessmentSection(assessmentSection)); + } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj =================================================================== diff -u -r3626842af8fe45995839d4bffeb820251334bc77 -r38dc28e4feb88ad7d1f12b77d90d24de0bfa2663 --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 3626842af8fe45995839d4bffeb820251334bc77) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 38dc28e4feb88ad7d1f12b77d90d24de0bfa2663) @@ -77,6 +77,11 @@ Ringtoets.AssemblyTool.Data False + + {358B6DA2-A1DF-477F-B6AC-C30204265CB0} + Ringtoets.AssemblyTool.KernelWrapper + False + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} Ringtoets.Common.Data Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs =================================================================== diff -u -r3626842af8fe45995839d4bffeb820251334bc77 -r38dc28e4feb88ad7d1f12b77d90d24de0bfa2663 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs (.../ExportableAssessmentSectionFactoryTest.cs) (revision 3626842af8fe45995839d4bffeb820251334bc77) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs (.../ExportableAssessmentSectionFactoryTest.cs) (revision 38dc28e4feb88ad7d1f12b77d90d24de0bfa2663) @@ -2,7 +2,12 @@ using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Exceptions; using Ringtoets.Integration.Data; using Ringtoets.Integration.IO.Assembly; using Ringtoets.Integration.IO.Factories; @@ -43,16 +48,52 @@ ReferenceLine = referenceLine }; - // Call - ExportableAssessmentSection exportableAssessmentSection = ExportableAssessmentSectionFactory.CreateExportableAssessmentSection(assessmentSection); + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + AssessmentSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedAssessmentSectionAssemblyCalculator; + calculator.AssembleAssessmentSectionCategoryGroupOutput = random.NextEnumValue(); - // 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); + // Call + ExportableAssessmentSection exportableAssessmentSection = ExportableAssessmentSectionFactory.CreateExportableAssessmentSection(assessmentSection); + + // Assert + Assert.AreEqual(name, exportableAssessmentSection.Name); + CollectionAssert.AreEqual(referenceLine.Points, exportableAssessmentSection.Geometry); + + ExportableAssessmentSectionAssemblyResult exportableAssessmentSectionAssemblyResult = exportableAssessmentSection.AssessmentSectionAssembly; + Assert.AreEqual(calculator.AssembleAssessmentSectionCategoryGroupOutput, exportableAssessmentSectionAssemblyResult.AssemblyCategory); + Assert.AreEqual(ExportableAssemblyMethod.WBI2C1, exportableAssessmentSectionAssemblyResult.AssemblyMethod); + + CollectionAssert.IsEmpty(exportableAssessmentSection.FailureMechanismsWithProbability); + CollectionAssert.IsEmpty(exportableAssessmentSection.FailureMechanismsWithoutProbability); + Assert.IsNotNull(exportableAssessmentSection.CombinedSectionAssemblyResults); + } } + + [Test] + public void CreateExportableAssessmentSection_AssessmentSectionAssemblyCalculatorThrowsException_ThrowsAssemblyException() + { + // Setup + var random = new Random(21); + var assessmentSection = new AssessmentSection(random.NextEnumValue()) + { + Name = "assessmentSectionName", + ReferenceLine = new ReferenceLine() + }; + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance; + AssessmentSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedAssessmentSectionAssemblyCalculator; + calculator.ThrowExceptionOnCalculate = true; + + // Call + TestDelegate call = () => ExportableAssessmentSectionFactory.CreateExportableAssessmentSection(assessmentSection); + + // Assert + Assert.Throws(call); + } + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj =================================================================== diff -u -r3626842af8fe45995839d4bffeb820251334bc77 -r38dc28e4feb88ad7d1f12b77d90d24de0bfa2663 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 3626842af8fe45995839d4bffeb820251334bc77) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 38dc28e4feb88ad7d1f12b77d90d24de0bfa2663) @@ -1,4 +1,4 @@ - + {06C448C6-CBDE-4579-B5B6-1B8074E022ED} @@ -60,6 +60,14 @@ {420ED9C3-0C33-47EA-B893-121A9C0DB4F1} Ringtoets.AssemblyTool.Data + + {358B6DA2-A1DF-477F-B6AC-C30204265CB0} + Ringtoets.AssemblyTool.KernelWrapper + + + {0AB432BB-E2CC-42EA-A72C-7AFEF7536B38} + Ringtoets.AssemblyTool.KernelWrapper.TestUtil + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} Ringtoets.Common.Data