Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r65af0c896b50865f6ffe14d230ae0691202aea4e -r4848313b00f4765d72a8330caf521d8d3d04d7da --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs (.../WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs) (revision 65af0c896b50865f6ffe14d230ae0691202aea4e) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs (.../WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs) (revision 4848313b00f4765d72a8330caf521d8d3d04d7da) @@ -29,6 +29,7 @@ using Ringtoets.Common.Data.AssemblyTool; using Ringtoets.Common.Data.Exceptions; using Ringtoets.Common.Primitives; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.WaveImpactAsphaltCover.Data { @@ -222,21 +223,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/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r6d8e05710b2c63e1f1f62ff3fd1b73346618286f -r4848313b00f4765d72a8330caf521d8d3d04d7da --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs (.../WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs) (revision 6d8e05710b2c63e1f1f62ff3fd1b73346618286f) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs (.../WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs) (revision 4848313b00f4765d72a8330caf521d8d3d04d7da) @@ -644,6 +644,30 @@ } } + [Test] + public void AssembleFailureMechanism_FailureMechanismSectionCalculatorThrowsException_ThrowsAssemblyException() + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + calculator.ThrowExceptionOnCalculate = true; + + // Call + TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.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