Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r618b76f6429ba110aae26879a227af8f4f3762f0 -r9fa3b8b88015dfae67c87dc4d03c418995f0356f --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismAssemblyFactory.cs (.../ClosingStructuresFailureMechanismAssemblyFactory.cs) (revision 618b76f6429ba110aae26879a227af8f4f3762f0) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismAssemblyFactory.cs (.../ClosingStructuresFailureMechanismAssemblyFactory.cs) (revision 9fa3b8b88015dfae67c87dc4d03c418995f0356f) @@ -238,7 +238,7 @@ if (!failureMechanism.IsRelevant) { - return FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(); + return FailureMechanismAssemblyResultFactory.CreateNotApplicableAssembly(); } IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; @@ -266,32 +266,21 @@ /// The failure mechanism to assemble for. /// The the failure mechanism belongs to. /// The input parameters used to determine the assembly categories. + /// A collection of all section assembly results. /// Thrown when a /// could not be created. - /// A collection of all section assembly results. private static IEnumerable AssembleSections(ClosingStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection, AssemblyCategoriesInput assemblyCategoriesInput) { - IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; - IFailureMechanismSectionAssemblyCalculator sectionCalculator = - calculatorFactory.CreateFailureMechanismSectionAssemblyCalculator(AssemblyToolKernelFactory.Instance); - var sectionAssemblies = new List(); foreach (ClosingStructuresFailureMechanismSectionResult sectionResult in failureMechanism.SectionResults) { FailureMechanismSectionAssembly sectionAssembly; if (sectionResult.UseManualAssemblyProbability) { - try - { - sectionAssembly = sectionCalculator.AssembleManual(sectionResult.ManualAssemblyProbability, assemblyCategoriesInput); - } - catch (FailureMechanismSectionAssemblyCalculatorException e) - { - throw new AssemblyException(e.Message, e); - } + sectionAssembly = AssembleManualAssessment(sectionResult, assemblyCategoriesInput); } else { @@ -306,6 +295,32 @@ return sectionAssemblies; } + /// + /// Assembles the manual assembly. + /// + /// The failure mechanism section result to assemble the + /// manual assembly for. + /// The input parameters used to determine the assembly categories. + /// A . + /// Thrown when the + /// could not be created. + private static FailureMechanismSectionAssembly AssembleManualAssessment(ClosingStructuresFailureMechanismSectionResult sectionResult, + AssemblyCategoriesInput assemblyCategoriesInput) + { + IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; + IFailureMechanismSectionAssemblyCalculator calculator = + calculatorFactory.CreateFailureMechanismSectionAssemblyCalculator(AssemblyToolKernelFactory.Instance); + + try + { + return calculator.AssembleManual(sectionResult.ManualAssemblyProbability, assemblyCategoriesInput); + } + catch (FailureMechanismSectionAssemblyCalculatorException e) + { + throw new AssemblyException(e.Message, e); + } + } + private static AssemblyCategoriesInput CreateAssemblyCategoriesInput(ClosingStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection) { Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c -r9fa3b8b88015dfae67c87dc4d03c418995f0356f --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismAssemblyFactoryTest.cs (.../ClosingStructuresFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismAssemblyFactoryTest.cs (.../ClosingStructuresFailureMechanismAssemblyFactoryTest.cs) (revision 9fa3b8b88015dfae67c87dc4d03c418995f0356f) @@ -658,17 +658,14 @@ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); mocks.ReplayAll(); - using (new AssemblyToolCalculatorFactoryConfig()) - { - // Call - FailureMechanismAssembly assembly = ClosingStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism( - failureMechanism, - assessmentSection); + // Call + FailureMechanismAssembly assembly = ClosingStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism( + failureMechanism, + assessmentSection); - // Assert - AssemblyToolTestHelper.AssertAreEqual(FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(), assembly); - mocks.VerifyAll(); - } + // Assert + AssemblyToolTestHelper.AssertAreEqual(FailureMechanismAssemblyResultFactory.CreateNotApplicableAssembly(), assembly); + mocks.VerifyAll(); } [Test]