Esempio n. 1
0
        public void DetailedAssessmentDirectFailureMechanismsGroupThreeReturnsCorrectCategory(DetailedCalculationResult iToII, DetailedCalculationResult iIToIII, DetailedCalculationResult iIIToIV, DetailedCalculationResult iVToV, DetailedCalculationResult vToVI, FailureMechanismSectionCategoryGroup expectedCategoryGroup)
        {
            var input             = new DetailedCategoryBoundariesCalculationResult(iToII, iIToIII, iIIToIV, iVToV, vToVI);
            var calculationOutput = new FailureMechanismSectionAssemblyCalculator().DetailedAssessmentDirectFailureMechanisms(input);

            Assert.IsNotNull(calculationOutput);
            Assert.IsEmpty(calculationOutput.WarningMessages);
            Assert.IsNotNull(calculationOutput.Result);
            Assert.AreEqual(expectedCategoryGroup, calculationOutput.Result);
        }
Esempio n. 2
0
        public void DetailedAssessmentDirectFailureMechanismsGroupThreeThrowsOnImpossibleResultCombination(DetailedCalculationResult iToII, DetailedCalculationResult iIToIII, DetailedCalculationResult iIIToIV, DetailedCalculationResult iVToV, DetailedCalculationResult vToVI)
        {
            var input = new DetailedCategoryBoundariesCalculationResult(iToII, iIToIII, iIIToIV, iVToV, vToVI);

            try
            {
                new FailureMechanismSectionAssemblyCalculator().DetailedAssessmentDirectFailureMechanisms(input);
                Assert.Fail("Expected exception.");
            }
            catch (AssemblyToolKernelException e)
            {
                Assert.AreEqual(1, e.Code.Length);
                Assert.AreEqual(ErrorCode.ImpossibleResultCombination, e.Code[0]);
            }
        }
        public void ConstructorPassesPropertiesCorrectly()
        {
            var iToII   = DetailedCalculationResult.NGO;
            var iIToIII = DetailedCalculationResult.V;
            var iIIToIV = DetailedCalculationResult.VN;
            var iVToV   = DetailedCalculationResult.NGO;
            var vToVi   = DetailedCalculationResult.NGO;

            var detailedAssessmentCategoryBoundariesResult = new DetailedCategoryBoundariesCalculationResult(iToII, iIToIII, iIIToIV, iVToV, vToVi);

            Assert.AreEqual(iToII, detailedAssessmentCategoryBoundariesResult.ResultItoII);
            Assert.AreEqual(iIToIII, detailedAssessmentCategoryBoundariesResult.ResultIItoIII);
            Assert.AreEqual(iIIToIV, detailedAssessmentCategoryBoundariesResult.ResultIIItoIV);
            Assert.AreEqual(iVToV, detailedAssessmentCategoryBoundariesResult.ResultIVtoV);
            Assert.AreEqual(vToVi, detailedAssessmentCategoryBoundariesResult.ResultVtoVI);
        }
        public CalculationOutput <FailureMechanismSectionCategoryGroup> DetailedAssessmentDirectFailureMechanisms(DetailedCategoryBoundariesCalculationResult calculationResults)
        {
            if (calculationResults.ResultItoII == DetailedCalculationResult.V)
            {
                if (calculationResults.ResultIItoIII == DetailedCalculationResult.VN ||
                    calculationResults.ResultIIItoIV == DetailedCalculationResult.VN ||
                    calculationResults.ResultIVtoV == DetailedCalculationResult.VN ||
                    calculationResults.ResultVtoVI == DetailedCalculationResult.VN)
                {
                    throw new AssemblyToolKernelException(ErrorCode.ImpossibleResultCombination);
                }
                return(new CalculationOutput <FailureMechanismSectionCategoryGroup>(FailureMechanismSectionCategoryGroup.Iv));
            }

            if (calculationResults.ResultIItoIII == DetailedCalculationResult.V)
            {
                if (calculationResults.ResultIIItoIV == DetailedCalculationResult.VN ||
                    calculationResults.ResultIVtoV == DetailedCalculationResult.VN ||
                    calculationResults.ResultVtoVI == DetailedCalculationResult.VN)
                {
                    throw new AssemblyToolKernelException(ErrorCode.ImpossibleResultCombination);
                }
                return(new CalculationOutput <FailureMechanismSectionCategoryGroup>(FailureMechanismSectionCategoryGroup.IIv));
            }

            if (calculationResults.ResultIIItoIV == DetailedCalculationResult.V)
            {
                if (calculationResults.ResultIVtoV == DetailedCalculationResult.VN ||
                    calculationResults.ResultVtoVI == DetailedCalculationResult.VN)
                {
                    throw new AssemblyToolKernelException(ErrorCode.ImpossibleResultCombination);
                }
                return(new CalculationOutput <FailureMechanismSectionCategoryGroup>(FailureMechanismSectionCategoryGroup.IIIv));
            }

            if (calculationResults.ResultIVtoV == DetailedCalculationResult.V)
            {
                if (calculationResults.ResultVtoVI == DetailedCalculationResult.VN)
                {
                    throw new AssemblyToolKernelException(ErrorCode.ImpossibleResultCombination);
                }
                return(new CalculationOutput <FailureMechanismSectionCategoryGroup>(FailureMechanismSectionCategoryGroup.IVv));
            }

            if (calculationResults.ResultVtoVI == DetailedCalculationResult.V)
            {
                return(new CalculationOutput <FailureMechanismSectionCategoryGroup>(FailureMechanismSectionCategoryGroup.Vv));
            }

            if (calculationResults.ResultVtoVI == DetailedCalculationResult.VN)
            {
                return(new CalculationOutput <FailureMechanismSectionCategoryGroup>(FailureMechanismSectionCategoryGroup.VIv));
            }

            if (calculationResults.ResultItoII == DetailedCalculationResult.NGO ||
                calculationResults.ResultIItoIII == DetailedCalculationResult.NGO ||
                calculationResults.ResultIIItoIV == DetailedCalculationResult.NGO ||
                calculationResults.ResultIVtoV == DetailedCalculationResult.NGO ||
                calculationResults.ResultVtoVI == DetailedCalculationResult.NGO)
            {
                return(new CalculationOutput <FailureMechanismSectionCategoryGroup>(FailureMechanismSectionCategoryGroup.VIIv));
            }

            return(new CalculationOutput <FailureMechanismSectionCategoryGroup>(FailureMechanismSectionCategoryGroup.None));
        }