示例#1
0
        public void CalculateFailureMechanismSectionAssemblyGroupBoundaries_KernelWithCompleteOutput_ReturnsExpectedFailureMechanismSectionAssembly()
        {
            // Setup
            const double maximumAllowableFloodingProbability = 0.001;
            const double signalFloodingProbability           = 0.0001;

            using (new AssemblyToolKernelFactoryConfig())
            {
                var factory = (TestAssemblyToolKernelFactory)AssemblyToolKernelFactory.Instance;
                AssemblyCategoryLimitsKernelStub        categoryLimitsKernel     = factory.LastCreatedAssemblyCategoryLimitsKernel;
                CategoriesList <InterpretationCategory> interpretationCategories = CreateInterpretationCategories();
                categoryLimitsKernel.InterpretationCategoryLimits = interpretationCategories;

                var calculator = new FailureMechanismSectionAssemblyGroupBoundariesCalculator(factory);

                // Call
                IEnumerable <FailureMechanismSectionAssemblyGroupBoundaries> result =
                    calculator.CalculateFailureMechanismSectionAssemblyGroupBoundaries(signalFloodingProbability, maximumAllowableFloodingProbability);

                // Assert
                Assert.IsTrue(categoryLimitsKernel.Calculated);

                FailureMechanismSectionAssemblyGroupBoundariesAssert.AssertFailureMechanismSectionAssemblyGroupBoundaries(interpretationCategories, result);
            }
        }
        public void CreateFailureMechanismSectionAssemblyGroupBoundaries_WithValidInterpretationCategories_ReturnsExpectedFailureMechanismSectionAssemblyGroups()
        {
            // Setup
            var random = new Random(11);

            var groups = new CategoriesList <InterpretationCategory>(new[]
            {
                new InterpretationCategory(random.NextEnumValue <EInterpretationCategory>(), new Probability(0), new Probability(0.25)),
                new InterpretationCategory(random.NextEnumValue <EInterpretationCategory>(), new Probability(0.25), new Probability(0.5)),
                new InterpretationCategory(random.NextEnumValue <EInterpretationCategory>(), new Probability(0.5), new Probability(0.75)),
                new InterpretationCategory(random.NextEnumValue <EInterpretationCategory>(), new Probability(0.75), new Probability(1))
            });

            // Call
            IEnumerable <FailureMechanismSectionAssemblyGroupBoundaries> assemblyGroups =
                FailureMechanismSectionAssemblyGroupCreator.CreateFailureMechanismSectionAssemblyGroupBoundaries(groups);

            // Assert
            FailureMechanismSectionAssemblyGroupBoundariesAssert.AssertFailureMechanismSectionAssemblyGroupBoundaries(groups, assemblyGroups);
        }