コード例 #1
0
        public void CanCreateEmptyQualitySpecification()
        {
            var xmlQualitySpecification = new XmlQualitySpecification {
                Name = "Empty"
            };

            var xmlDocument = new XmlDataQualityDocument();

            xmlDocument.AddQualitySpecification(xmlQualitySpecification);

            var modelFactory =
                new VerifiedModelFactory(CreateWorkspaceContext,
                                         new SimpleVerifiedDatasetHarvester());

            var factory = new XmlBasedQualitySpecificationFactory(
                modelFactory, new SimpleDatasetOpener(new MasterDatabaseDatasetContext()));

            QualitySpecification qualitySpecification =
                factory.CreateQualitySpecification(xmlDocument, xmlQualitySpecification.Name,
                                                   new DataSource[] { });

            Assert.AreEqual(xmlQualitySpecification.Name, qualitySpecification.Name);
        }
コード例 #2
0
        public void CanCreateQualitySpecificationIgnoringUnkownDatasets()
        {
            var    locator     = TestDataLocator.Create("ProSuite", @"QA\TestData");
            string catalogPath = locator.GetPath("QATestData.mdb");

            var xmlQCon = new XmlQualityCondition
            {
                Name = "Simple",
                TestDescriptorName = _xmlTestDescriptorSimple.Name
            };

            xmlQCon.ParameterValues.Add(new XmlDatasetTestParameterValue
            {
                TestParameterName = "featureClass",
                Value             = "UNKNOWN",
                WorkspaceId       = _xmlWorkspace.ID
            });

            var xmlQSpec = new XmlQualitySpecification {
                Name = "qspec"
            };

            xmlQSpec.Elements.Add(new XmlQualitySpecificationElement
            {
                QualityConditionName = xmlQCon.Name
            });

            var xmlDocument = new XmlDataQualityDocument();

            xmlDocument.AddWorkspace(_xmlWorkspace);
            xmlDocument.AddQualitySpecification(xmlQSpec);
            xmlDocument.AddQualityCondition(xmlQCon);
            xmlDocument.AddTestDescriptor(_xmlTestDescriptorSimple);

            var modelFactory =
                new VerifiedModelFactory(CreateWorkspaceContext,
                                         new SimpleVerifiedDatasetHarvester());

            var factory = new XmlBasedQualitySpecificationFactory(
                modelFactory, new SimpleDatasetOpener(new MasterDatabaseDatasetContext()));

            var dataSource = new DataSource(_xmlWorkspace)
            {
                WorkspaceAsText = catalogPath
            };

            const bool ignoreConditionsForUnknownDatasets = true;

            QualitySpecification qualitySpecification;

            try
            {
                qualitySpecification =
                    factory.CreateQualitySpecification(xmlDocument, xmlQSpec.Name,
                                                       new[] { dataSource },
                                                       ignoreConditionsForUnknownDatasets);
            }
            catch (Exception)
            {
                // TODO: Move test data to different format
                if (EnvironmentUtils.Is64BitProcess)
                {
                    Console.WriteLine("Expected exception: PGDB is not supported on x64");
                    return;
                }

                throw;
            }

            Assert.AreEqual(xmlQSpec.Name, qualitySpecification.Name);
            Assert.AreEqual(0, qualitySpecification.Elements.Count);
        }