private static IEnumerable <HtmlDataQualityCategory> GroupByCategories( [NotNull] IEnumerable <QualitySpecificationElement> elements, [NotNull] IDictionary <TestDescriptor, HtmlTestDescriptor> testDescriptors, [NotNull] HtmlDataQualityCategoryComparer categoryComparer, [NotNull] HtmlQualitySpecificationElementComparer elementComparer, [CanBeNull] IHtmlDataQualityCategoryOptionsProvider optionsProvider, [NotNull] out List <HtmlQualitySpecificationElement> htmlQualitySpecificationElements) { List <QualitySpecificationElement> elementsList = elements.ToList(); IDictionary <string, HtmlDataQualityCategory> reportCategories = MapReportCategories(elementsList, categoryComparer, elementComparer, optionsProvider); htmlQualitySpecificationElements = new List <HtmlQualitySpecificationElement>(); foreach (QualitySpecificationElement element in elementsList) { HtmlDataQualityCategory reportCategory = reportCategories[GetCategoryKey(element.QualityCondition.Category)]; HtmlTestDescriptor htmlTestDescriptor = testDescriptors[element.QualityCondition.TestDescriptor]; var htmlQualityCondition = new HtmlQualityCondition( element.QualityCondition, htmlTestDescriptor, reportCategory); var htmlElement = new HtmlQualitySpecificationElement(htmlQualityCondition, element); reportCategory.AddQualitySpecificationElement(htmlElement); htmlQualitySpecificationElements.Add(htmlElement); htmlTestDescriptor.AddReferencingElement(htmlElement); } htmlQualitySpecificationElements.Sort(elementComparer); // exclude undefined root category if it does not contain any quality conditions return(reportCategories.Values .Where(cat => !cat.IsRoot || !cat.IsUndefinedCategory || cat.QualitySpecificationElements.Count > 0) .Distinct() .OrderBy(c => c, categoryComparer) .ToList()); }
internal HtmlQualitySpecificationElement( [NotNull] HtmlQualityCondition htmlQualityCondition, [NotNull] QualitySpecificationElement element) { Assert.ArgumentNotNull(htmlQualityCondition, nameof(htmlQualityCondition)); Assert.ArgumentNotNull(element, nameof(element)); _htmlQualityCondition = htmlQualityCondition; _element = element; IssueType = _element.AllowErrors ? LocalizableStrings.IssueType_Warning : LocalizableStrings.IssueType_Error; }