public void AddCondition([NotNull] XmlVerifiedQualityCondition condition)
        {
            Assert.ArgumentNotNull(condition, nameof(condition));

            _conditions.Add(condition);
            _conditionSortOrderDirty = true;

            ConditionCount  = _conditions.Count;
            ExceptionCount += condition.ExceptionCount;

            switch (condition.Type)
            {
            case XmlQualityConditionType.Soft:
                WarningCount += condition.IssueCount;
                break;

            case XmlQualityConditionType.Hard:
                ErrorCount += condition.IssueCount;
                break;

            default:
                throw new ArgumentOutOfRangeException(
                          string.Format("Condition '{0}' has an unsupported type: {1}",
                                        condition.Name, condition.Type));
            }

            UpdateCountsWithChildren();
        }
        public void AddConditionWithIssues(
            [NotNull] XmlVerifiedQualityCondition xmlCondition)
        {
            Assert.ArgumentNotNull(xmlCondition, nameof(xmlCondition));

            _categoriesWithIssuesBuilder.AddVerifiedCondition(xmlCondition);
        }
        private void AddToCategory(
            [NotNull] XmlVerifiedQualityCondition xmlVerifiedCondition,
            [NotNull] DataQualityCategory category)
        {
            XmlVerifiedCategory xmlCategory = GetVerifiedCategory(category);

            xmlCategory.AddCondition(xmlVerifiedCondition);
        }
        public void AddVerifiedCondition(
            [NotNull] XmlVerifiedQualityCondition xmlVerifiedCondition)
        {
            Assert.ArgumentNotNull(xmlVerifiedCondition, nameof(xmlVerifiedCondition));

            DataQualityCategory category = xmlVerifiedCondition.Category;

            if (category == null)
            {
                AddToUndefinedCategory(xmlVerifiedCondition);
            }
            else
            {
                AddToCategory(xmlVerifiedCondition, category);
            }
        }
        private void AddToUndefinedCategory(
            [NotNull] XmlVerifiedQualityCondition xmlVerifiedCondition)
        {
            string key = string.Empty;

            XmlVerifiedCategory xmlCategory;

            if (!_categoriesByUuid.TryGetValue(key, out xmlCategory))
            {
                xmlCategory = new XmlVerifiedCategory("<no category>");

                _categoriesByUuid.Add(key, xmlCategory);
                _rootCategories.Add(xmlCategory);

                _sortOrderDirty = true;
            }

            xmlCategory.AddCondition(xmlVerifiedCondition);
        }
Example #6
0
        private static XmlVerifiedQualityCondition CreateVerifiedQualityCondition(
            [NotNull] QualitySpecificationElement element,
            [NotNull] ICollection <XmlIssue> issues,
            [CanBeNull] IQualityConditionExceptionStatistics exceptionStatistics,
            bool reportIssues,
            bool reportParameters,
            bool reportDescription)
        {
            QualityCondition qualityCondition = element.QualityCondition;

            var result =
                new XmlVerifiedQualityCondition
            {
                Name        = Escape(qualityCondition.Name),
                Guid        = qualityCondition.Uuid,
                VersionGuid = qualityCondition.VersionUuid,
                Type        = element.AllowErrors
                                                       ? XmlQualityConditionType.Soft
                                                       : XmlQualityConditionType.Hard,
                StopCondition = element.StopOnError,
                Category      = qualityCondition.Category
            };

            if (issues.Count > 0)
            {
                if (reportIssues)
                {
                    result.AddIssues(issues, element.ReportIndividualErrors);
                }
                else
                {
                    result.IssueCount = issues.Count;
                }
            }

            if (reportParameters)
            {
                result.TestDescriptor = GetTestDescriptor(qualityCondition.TestDescriptor);
                result.AddParameters(GetParameters(qualityCondition));
            }

            if (reportDescription)
            {
                if (StringUtils.IsNotEmpty(qualityCondition.Description))
                {
                    result.Description = Escape(qualityCondition.Description);
                }

                if (StringUtils.IsNotEmpty(qualityCondition.Url))
                {
                    result.Url = Escape(qualityCondition.Url);
                }
            }

            if (exceptionStatistics != null)
            {
                result.ExceptionCount = exceptionStatistics.ExceptionCount;
            }

            return(result);
        }
Example #7
0
 public void AddVerifiedCondition(
     [NotNull] XmlVerifiedQualityCondition verifiedCondition)
 {
     _categoriesBuilder.AddVerifiedCondition(verifiedCondition);
 }