Beispiel #1
0
        internal HtmlTestDescriptor([NotNull] TestDescriptor testDescriptor)
        {
            Assert.ArgumentNotNull(testDescriptor, nameof(testDescriptor));

            TestFactory testFactory =
                Assert.NotNull(TestDescriptorUtils.GetTestFactory(testDescriptor));

            Name        = testDescriptor.Name;
            Description = StringUtils.IsNotEmpty(testDescriptor.Description)
                                              ? testDescriptor.Description
                                              : null;

            TestDescription = testFactory.GetTestDescription();
            Signature       = TestImplementationUtils.GetTestSignature(testFactory);

            Type testType;

            if (testDescriptor.TestClass != null)
            {
                testType        = testDescriptor.TestClass.GetInstanceType();
                ConstructorId   = testDescriptor.TestConstructorId;
                UsesConstructor = true;
                IsObsolete      = TestDescriptorUtils.IsObsolete(testType, ConstructorId,
                                                                 out _obsoleteMessage);
            }
            else if (testDescriptor.TestFactoryDescriptor != null)
            {
                testType        = testDescriptor.TestFactoryDescriptor.GetInstanceType();
                ConstructorId   = -1;
                UsesConstructor = false;
                IsObsolete      = ReflectionUtils.IsObsolete(testType, out _obsoleteMessage);
            }
            else
            {
                throw new ArgumentException("Invalid test descriptor");
            }

            AssemblyName = Path.GetFileName(testType.Assembly.Location);
            ClassName    = testType.FullName;

            _issueCodes     = IssueCodeUtils.GetIssueCodes(testType).ToList();
            _testCategories = testFactory.TestCategories.OrderBy(c => c).ToList();

            foreach (TestParameter testParameter in testFactory.Parameters)
            {
                var htmlTestParameter = new HtmlTestParameter(testParameter);

                _parameters.Add(htmlTestParameter);
                _testParametersByName.Add(testParameter.Name, htmlTestParameter);
            }
        }
        internal HtmlTestParameterValue([NotNull] TestParameterValue testParameterValue,
                                        [NotNull] HtmlTestParameter testParameter)
        {
            Name  = testParameterValue.TestParameterName;
            Value = testParameterValue.StringValue;

            TestParameter = testParameter;
            var datasetParameterValue = testParameterValue as DatasetTestParameterValue;

            if (datasetParameterValue != null)
            {
                Dataset dataset = Assert.NotNull(datasetParameterValue.DatasetValue);
                DatasetValue        = dataset;
                Dataset             = dataset.Name;
                IsDatasetParameter  = true;
                FilterExpression    = datasetParameterValue.FilterExpression;
                DataModel           = dataset.Model.Name;
                UsedAsReferenceData = datasetParameterValue.UsedAsReferenceData;
                DatasetGeometryType = HtmlDataset.GetGeometryTypeName(dataset);
            }
        }
        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));
            }
        }