/// <summary>
        /// Tests the norm categories.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <param name="result">The result.</param>
        public static void TestEqualNormCategories(BenchmarkTestInput input, BenchmarkTestResult result)
        {
            var calculator = new CategoryLimitsCalculator();

            // WBI-2-1
            CategoriesList <AssessmentSectionCategory> categories = calculator.CalculateAssessmentSectionCategoryLimitsWbi21(
                new AssessmentSection((Probability)input.SignalingNorm, (Probability)input.LowerBoundaryNorm));
            CategoriesList <AssessmentSectionCategory> expectedCategories =
                input.ExpectedAssessmentSectionCategories;

            result.AreEqualCategoriesListAssessmentSection =
                AssertHelper.AssertEqualCategoriesList <AssessmentSectionCategory, EAssessmentGrade>(
                    expectedCategories, categories);
            result.MethodResults.Wbi21 = result.AreEqualCategoriesListAssessmentSection;
        }
        public void Wbi2B1FailureProbabilityTests(double prob1, double prob2, double expectedProb, EAssessmentGrade expectedGrade)
        {
            var categories = categoriesCalculator.CalculateAssessmentSectionCategoryLimitsWbi21(assessmentSection);
            var failureMechanismProbabilities = new[]
            {
                (Probability)prob1,
                (Probability)prob2,
            };
            var result = assembler.AssembleAssessmentSectionWbi2B1(failureMechanismProbabilities, categories, false);

            Assert.NotNull(result.FailureProbability);
            Assert.AreEqual(expectedProb, result.FailureProbability, 10);
            Assert.AreEqual(expectedGrade, result.Category);
        }
        public void FullAssembly()
        {
            const int sectionLength = 3750;
            var       section       = new AssessmentSection((Probability)1.0E-3, (Probability)(1.0 / 300.0));
            var       failureMechanismSectionResultsDictionary = new Dictionary <double, List <FailureMechanismSection> >();
            var       failureMechanismSectionLists             = new List <FailureMechanismSectionList>();

            // create section results for 15 failure mechanisms with 250 sections each
            CreateTestInput(sectionLength, failureMechanismSectionResultsDictionary);

            // start timer
            var watch = Stopwatch.StartNew();

            var failureMechanismResultsWithFailureProb = new List <FailureMechanismAssemblyResult>();

            // assembly step 1
            var categoriesCalculator = new CategoryLimitsCalculator();

            foreach (var failureMechanismSectionResults in failureMechanismSectionResultsDictionary)
            {
                var result = failureMechanismResultAssembler.AssembleFailureMechanismWbi1B1(
                    failureMechanismSectionResults.Key,
                    failureMechanismSectionResults.Value.Select(failureMechanismSection => failureMechanismSection.Result),
                    false);
                failureMechanismResultsWithFailureProb.Add(result);

                failureMechanismSectionLists.Add(CreateFailureMechanismSectionListForStep3(failureMechanismSectionResults.Value));
            }

            // assembly step 2
            var categories = categoriesCalculator.CalculateAssessmentSectionCategoryLimitsWbi21(section);
            var assessmentGradeWithFailureProb =
                assessmentSectionAssembler.AssembleAssessmentSectionWbi2B1(failureMechanismResultsWithFailureProb.Select(r => r.Probability).ToArray(), categories, false);

            // assembly step 3
            combinedSectionAssembler.AssembleCommonFailureMechanismSections(failureMechanismSectionLists, sectionLength, false);
            watch.Stop();

            var elapsedMs = watch.Elapsed.TotalMilliseconds;

            Console.Out.WriteLine($"Elapsed time since start of assembly: {elapsedMs} ms (max: 1000 ms)");
        }