Exemplo n.º 1
0
        public void SimpleAssessmentDirectFailureMechanismsReturnsCorrectCategory(SimpleCalculationResult calculationResult, FailureMechanismSectionCategoryGroup expectedResult, double expectedProbability)
        {
            var calculationOutput = new FailureMechanismSectionAssemblyCalculator().SimpleAssessmentDirectFailureMechanisms(calculationResult);

            Assert.IsNotNull(calculationOutput);
            Assert.IsEmpty(calculationOutput.WarningMessages);
            Assert.IsNotNull(calculationOutput.Result);
            Assert.AreEqual(expectedResult, calculationOutput.Result.CategoryGroup);
            Assert.AreEqual(expectedProbability, calculationOutput.Result.EstimatedProbabilityOfFailure);
        }
Exemplo n.º 2
0
        public void SimpleAssessmentDirectFailureMechanismsThrowsOnInvalidEnum()
        {
            const SimpleCalculationResult invalidEnum = (SimpleCalculationResult)15;

            Assert.Throws <InvalidEnumArgumentException>(() => new FailureMechanismSectionAssemblyCalculator().SimpleAssessmentDirectFailureMechanisms(invalidEnum));
        }
 public CalculationOutput <FailureMechanismSectionCategoryGroup> SimpleAssessmentIndirectFailureMechanisms(SimpleCalculationResult result)
 {
     throw new NotImplementedException();
 }
        public CalculationOutput <FailureMechanismSectionAssemblyCategoryResult> SimpleAssessmentDirectFailureMechanisms(SimpleCalculationResult result)
        {
            switch (result)
            {
            case SimpleCalculationResult.NVT:
                return(new CalculationOutput <FailureMechanismSectionAssemblyCategoryResult>(new FailureMechanismSectionAssemblyCategoryResult(FailureMechanismSectionCategoryGroup.NotApplicable, (Probability)0)));

            case SimpleCalculationResult.FV:
                return(new CalculationOutput <FailureMechanismSectionAssemblyCategoryResult>(new FailureMechanismSectionAssemblyCategoryResult(FailureMechanismSectionCategoryGroup.Iv, (Probability)0)));

            case SimpleCalculationResult.VB:
                return(new CalculationOutput <FailureMechanismSectionAssemblyCategoryResult>(new FailureMechanismSectionAssemblyCategoryResult(FailureMechanismSectionCategoryGroup.VIIv, Probability.NaN)));

            case SimpleCalculationResult.None:
                return(new CalculationOutput <FailureMechanismSectionAssemblyCategoryResult>(new FailureMechanismSectionAssemblyCategoryResult(FailureMechanismSectionCategoryGroup.None, Probability.NaN)));

            default:
                throw new InvalidEnumArgumentException();
            }
        }