Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r3f6e53d41b52485159c3c2b34693e30bfb294958 -r9c28314a8df95906c82654e67503f5a794aa741d --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs) (revision 3f6e53d41b52485159c3c2b34693e30bfb294958) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs) (revision 9c28314a8df95906c82654e67503f5a794aa741d) @@ -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/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r1b06b06acb5f70a4adc60c28ee9bcd3e9fd406a3 -r9c28314a8df95906c82654e67503f5a794aa741d --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs) (revision 1b06b06acb5f70a4adc60c28ee9bcd3e9fd406a3) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs) (revision 9c28314a8df95906c82654e67503f5a794aa741d) @@ -624,6 +624,30 @@ } } + [Test] + public void AssembleFailureMechanism_FailureMechanismSectionCalculatorThrowsException_ThrowsAssemblyException() + { + // Setup + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + calculator.ThrowExceptionOnCalculate = true; + + // Call + TestDelegate call = () => GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.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