コード例 #1
0
        public FailureMechanismSectionAssemblyResultWrapper AssembleFailureMechanismSection(FailureMechanismSectionAssemblyInput input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            try
            {
                IAssessmentResultsTranslator kernel = factory.CreateFailureMechanismSectionAssemblyKernel();

                if (!IsProbabilityDefined(input))
                {
                    return(AssembleWithUndefinedProbabilities(input, kernel));
                }

                Probability sectionProbability = kernel.DetermineRepresentativeProbabilityBoi0A1(
                    input.FurtherAnalysisType != FailureMechanismSectionResultFurtherAnalysisType.NotNecessary,
                    AssemblyCalculatorInputCreator.CreateProbability(input.InitialSectionProbability),
                    AssemblyCalculatorInputCreator.CreateProbability(input.RefinedSectionProbability));
                EInterpretationCategory interpretationCategory = AssembleInterpretationCategory(input, kernel, sectionProbability);

                return(new FailureMechanismSectionAssemblyResultWrapper(
                           FailureMechanismSectionAssemblyResultCreator.Create(sectionProbability, interpretationCategory),
                           AssemblyMethod.BOI0A1, AssemblyMethod.BOI0B1));
            }
            catch (AssemblyException e)
            {
                throw new FailureMechanismSectionAssemblyCalculatorException(AssemblyErrorMessageCreator.CreateErrorMessage(e.Errors), e);
            }
            catch (Exception e)
            {
                throw new FailureMechanismSectionAssemblyCalculatorException(AssemblyErrorMessageCreator.CreateGenericErrorMessage(), e);
            }
        }
コード例 #2
0
        public void CreateFailureMechanismSectionAssemblyKernel_Always_ReturnsKernelAssessmentResultsTranslator()
        {
            // Setup
            IAssemblyToolKernelFactory factory = AssemblyToolKernelFactory.Instance;

            // Call
            IAssessmentResultsTranslator kernel = factory.CreateFailureMechanismSectionAssemblyKernel();

            // Assert
            Assert.IsInstanceOf <AssessmentResultsTranslator>(kernel);
        }