Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r3f6e53d41b52485159c3c2b34693e30bfb294958 -r1feaa9e0b534cfe2a4fecaa58625f8e2fcc5e7a5 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactory.cs (.../PipingStructureFailureMechanismAssemblyFactory.cs) (revision 3f6e53d41b52485159c3c2b34693e30bfb294958) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactory.cs (.../PipingStructureFailureMechanismAssemblyFactory.cs) (revision 1feaa9e0b534cfe2a4fecaa58625f8e2fcc5e7a5) @@ -30,6 +30,7 @@ using Ringtoets.Common.Data.Exceptions; using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone.SectionResults; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.Integration.Data.StandAlone.AssemblyFactories { @@ -221,21 +222,25 @@ return FailureMechanismAssemblyResultFactory.CreateNotApplicableCategory(); } - IEnumerable sectionAssemblies = - failureMechanism.SectionResults.Select(GetSectionAssemblyCategoryGroup).ToArray(); - - IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; - IFailureMechanismAssemblyCalculator calculator = - calculatorFactory.CreateFailureMechanismAssemblyCalculator(AssemblyToolKernelFactory.Instance); - try { + IEnumerable sectionAssemblies = + failureMechanism.SectionResults.Select(GetSectionAssemblyCategoryGroup).ToArray(); + + IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; + IFailureMechanismAssemblyCalculator calculator = + calculatorFactory.CreateFailureMechanismAssemblyCalculator(AssemblyToolKernelFactory.Instance); + return calculator.Assemble(sectionAssemblies); } catch (FailureMechanismAssemblyCalculatorException e) { throw new AssemblyException(e.Message, e); } + catch (AssemblyException e) + { + throw new AssemblyException(RingtoetsCommonDataResources.FailureMechanismAssemblyFactory_Error_while_assembling_failureMechanism, e); + } } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r1b06b06acb5f70a4adc60c28ee9bcd3e9fd406a3 -r1feaa9e0b534cfe2a4fecaa58625f8e2fcc5e7a5 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactoryTest.cs (.../PipingStructureFailureMechanismAssemblyFactoryTest.cs) (revision 1b06b06acb5f70a4adc60c28ee9bcd3e9fd406a3) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactoryTest.cs (.../PipingStructureFailureMechanismAssemblyFactoryTest.cs) (revision 1feaa9e0b534cfe2a4fecaa58625f8e2fcc5e7a5) @@ -625,6 +625,30 @@ } } + [Test] + public void AssembleFailureMechanism_FailureMechanismSectionCalculatorThrowsException_ThrowsAssemblyException() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + calculator.ThrowExceptionOnCalculate = true; + + // Call + TestDelegate call = () => PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + var exception = Assert.Throws(call); + Exception innerException = exception.InnerException; + Assert.IsInstanceOf(innerException); + Assert.AreEqual("Voor een of meerdere vakken kan geen resultaat worden bepaald.", exception.Message); + } + } + #endregion } } \ No newline at end of file