internal HtmlQualitySpecification(
            [NotNull] QualitySpecification qualitySpecification,
            [NotNull] IEnumerable <HtmlDataQualityCategory> categories,
            [NotNull] IEnumerable <HtmlQualitySpecificationElement> elements,
            [NotNull] IEnumerable <HtmlTestDescriptor> testDescriptors,
            [NotNull] IEnumerable <HtmlDataModel> dataModels,
            DateTime reportCreationDate)
        {
            Name        = qualitySpecification.Name;
            Description = StringUtils.IsNotEmpty(qualitySpecification.Description)
                                              ? qualitySpecification.Description
                                              : null;
            Uuid = qualitySpecification.Uuid;
            ReportCreationDate = reportCreationDate;

            string url = qualitySpecification.Url;

            if (url != null && StringUtils.IsNotEmpty(url))
            {
                UrlText = url;
                UrlLink = SpecificationReportUtils.GetCompleteUrl(url);
            }

            if (qualitySpecification.TileSize != null)
            {
                HasTileSize = true;
                TileSize    = qualitySpecification.TileSize.Value;
            }
            else
            {
                HasTileSize = false;
                TileSize    = -1;
            }

            // collections are assumed to be ordered already
            _categories      = categories.ToList();
            _elements        = elements.ToList();
            _testDescriptors = testDescriptors.ToList();
            _rootCategories  = _categories.Where(c => c.IsRoot)
                               .ToList();
            _dataModels = dataModels.ToList();
        }
Exemplo n.º 2
0
        internal HtmlQualityCondition([NotNull] QualityCondition qualityCondition,
                                      [NotNull] HtmlTestDescriptor testDescriptor,
                                      [NotNull] HtmlDataQualityCategory category)
        {
            Assert.ArgumentNotNull(qualityCondition, nameof(qualityCondition));

            _qualityCondition = qualityCondition;
            TestDescriptor    = testDescriptor;
            Category          = category;

            Description = StringUtils.IsNotEmpty(qualityCondition.Description)
                                              ? qualityCondition.Description
                                              : null;
            Uuid        = qualityCondition.Uuid;
            VersionUuid = qualityCondition.VersionUuid;

            string url = qualityCondition.Url;

            if (url != null && StringUtils.IsNotEmpty(url))
            {
                UrlText = url;
                UrlLink = SpecificationReportUtils.GetCompleteUrl(url);
            }

            foreach (TestParameterValue value in qualityCondition.ParameterValues)
            {
                HtmlTestParameter parameter = testDescriptor.GetParameter(value.TestParameterName);

                if (parameter == null)
                {
                    // test parameter was deleted/renamed -> ignore value
                    continue;
                }

                _parameterValues.Add(new HtmlTestParameterValue(value, parameter));
            }
        }