public void CreateCombinedFailureMechanismSectionAssemblyKernel_Always_ReturnsKernelCommonFailureMechanismSectionAssembler()
        {
            // Setup
            IAssemblyToolKernelFactory factory = AssemblyToolKernelFactory.Instance;

            // Call
            ICommonFailureMechanismSectionAssembler kernel = factory.CreateCombinedFailureMechanismSectionAssemblyKernel();

            // Assert
            Assert.IsInstanceOf <CommonFailureMechanismSectionAssembler>(kernel);
        }
Ejemplo n.º 2
0
        public CombinedFailureMechanismSectionAssemblyResultWrapper AssembleCombinedFailureMechanismSections(
            IEnumerable <IEnumerable <CombinedAssemblyFailureMechanismSection> > input, double assessmentSectionLength)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            try
            {
                ICommonFailureMechanismSectionAssembler kernel = factory.CreateCombinedFailureMechanismSectionAssemblyKernel();

                IEnumerable <FailureMechanismSectionList> failureMechanismSections = FailureMechanismSectionListCreator.Create(input);
                FailureMechanismSectionList commonSections = kernel.FindGreatestCommonDenominatorSectionsBoi3A1(
                    failureMechanismSections, assessmentSectionLength);

                FailureMechanismSectionList[] failureMechanismResults = failureMechanismSections.Select(fmsl => kernel.TranslateFailureMechanismResultsToCommonSectionsBoi3B1(
                                                                                                            fmsl, commonSections))
                                                                        .ToArray();

                IEnumerable <FailureMechanismSectionWithCategory> combinedSectionResults =
                    kernel.DetermineCombinedResultPerCommonSectionBoi3C1(failureMechanismResults, false);

                return(new CombinedFailureMechanismSectionAssemblyResultWrapper(
                           CombinedFailureMechanismSectionAssemblyCreator.Create(failureMechanismResults, combinedSectionResults),
                           AssemblyMethod.BOI3A1, AssemblyMethod.BOI3B1, AssemblyMethod.BOI3C1));
            }
            catch (AssemblyException e)
            {
                throw new AssessmentSectionAssemblyCalculatorException(AssemblyErrorMessageCreator.CreateErrorMessage(e.Errors), e);
            }
            catch (Exception e)
            {
                throw new AssessmentSectionAssemblyCalculatorException(AssemblyErrorMessageCreator.CreateGenericErrorMessage(), e);
            }
        }