コード例 #1
0
        public static List <HtmlReportDataQualityCategory> GroupByCategories(
            [NotNull] IIssueStatistics issueStatistics,
            [NotNull] HtmlReportDataQualityCategoryComparer categoryComparer,
            [NotNull] HtmlReportQualityConditionComparer qualityConditionComparer,
            [NotNull] HtmlReportIssueGroupComparer issueGroupComparer,
            [CanBeNull] Func <IssueGroup, string> getTestIdentifier,
            [CanBeNull] IHtmlDataQualityCategoryOptionsProvider optionsProvider,
            [NotNull] out List <HtmlReportIssueGroup> htmlReportIssueGroups)
        {
            List <IssueGroup> issueGroupList = issueStatistics.GetIssueGroups().ToList();

            IDictionary <string, HtmlReportDataQualityCategory> reportCategories =
                MapReportCategories(issueGroupList,
                                    issueStatistics.ExceptionCategories,
                                    categoryComparer,
                                    qualityConditionComparer,
                                    issueGroupComparer,
                                    optionsProvider);

            int maximumIssueCount = GetMaximumIssueCount(issueGroupList);

            htmlReportIssueGroups = new List <HtmlReportIssueGroup>();

            foreach (IssueGroup issueGroup in issueGroupList)
            {
                string testIdentifier = getTestIdentifier != null
                                                                ? getTestIdentifier(issueGroup)
                                                                : issueGroup.QualityCondition.TestDescriptor.Name;

                var reportIssueGroup = new HtmlReportIssueGroup(issueGroup,
                                                                maximumIssueCount,
                                                                testIdentifier,
                                                                GetHtmlExceptionCategories(
                                                                    issueStatistics, issueGroup));

                HtmlReportDataQualityCategory reportCategory =
                    reportCategories[GetCategoryKey(issueGroup.QualityCondition.Category)];

                reportCategory.AddIssueGroup(reportIssueGroup, issueGroup.IssueCount);
                htmlReportIssueGroups.Add(reportIssueGroup);
            }

            htmlReportIssueGroups.Sort(issueGroupComparer);

            // exclude undefined root category if it does not contain any quality conditions

            return(reportCategories.Values
                   .Where(cat => !cat.IsRoot ||
                          !cat.IsUndefinedCategory ||
                          cat.QualityConditions.Count > 0)
                   .Distinct()
                   .OrderBy(c => c, categoryComparer)
                   .ToList());
        }
コード例 #2
0
        public void AddIssueGroup([NotNull] HtmlReportIssueGroup issueGroup, int issueCount)
        {
            Assert.ArgumentNotNull(issueGroup, nameof(issueGroup));

            _htmlExceptionCategoryCounts = null;

            _issueGroups.Add(issueGroup);
            _issueGroupsRequireSorting = true;

            Include(issueGroup.QualityCondition,
                    issueGroup.IsAllowable,
                    issueGroup.StopCondition,
                    issueCount,
                    issueGroup.ExceptionCategories);
        }