当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.BuildFromXml方法代码示例

本文整理汇总了C#中Configuration.BuildFromXml方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.BuildFromXml方法的具体用法?C# Configuration.BuildFromXml怎么用?C# Configuration.BuildFromXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Configuration的用法示例。


在下文中一共展示了Configuration.BuildFromXml方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Integrity

 /// <summary>
 /// Creates a new Integrity instance to query upon. Entry point to the API
 /// </summary>
 /// <param name="user">Username</param>
 /// <param name="password">Password</param>
 /// <param name="service_url">URL For Integrity instance, eg "http://integrity.myhost.com"</param>
 /// 
 public Integrity(string user, string password, string service_url)
 {
     _integrity_service = new IntegrityHttpService(service_url, user, password);
     _configuration = new Configuration();
     _configuration.BuildFromXml(_integrity_service.GetConfiguration());
     _integrity_interface = new IntegrityInterface(ref _integrity_service);
 }
开发者ID:C3,项目名称:IntegrityAPIIntegration,代码行数:14,代码来源:Integrity.cs

示例2: GetDatasetViaInvalidName

        public void GetDatasetViaInvalidName()
        {
            Configuration configuration = new Configuration();
            string xmlConfig = @"<user-access-group-authorisation><datasets type=""array"">
                    <dataset><id>9</id>
                    <name>people</name>
                    <is-bulk-allowed>false</is-bulk-allowed>
                    <is-incremental-allowed>true</is-incremental-allowed>
                    <table-name>dataset_name</table-name>
                    <qualifiers type=""array""/></dataset>
                </datasets></user-access-group-authorisation>";

            configuration.BuildFromXml(xmlConfig);
            configuration.GetDataset("staff");
        }
开发者ID:C3,项目名称:IntegrityAPIIntegration,代码行数:15,代码来源:ConfigurationTests.cs

示例3: GetDatasetViaId

 public void GetDatasetViaId()
 {
     Configuration configuration = new Configuration();
     string xmlConfig = @"<user-access-group-authorisation><datasets type=""array"">
             <dataset><id>9</id>
             <name>people</name>
             <is-bulk-allowed>false</is-bulk-allowed>
             <is-incremental-allowed>true</is-incremental-allowed>
             <table-name>dataset_name</table-name>
             <qualifiers type=""array""/></dataset>
         </datasets></user-access-group-authorisation>";
     configuration.BuildFromXml(xmlConfig);
     IntegrityDataset dataset = configuration.GetDataset("people");
     Assert.AreEqual(9, dataset.m_id);
 }
开发者ID:C3,项目名称:IntegrityAPIIntegration,代码行数:15,代码来源:ConfigurationTests.cs

示例4: UploadAttemptIncrementalTest

        public void UploadAttemptIncrementalTest()
        {
            string xml = @"<user-access-group-authorisation><name>beyond sync</name><datasets type=""array""><dataset><id>45</id><name>accreditation type</name><is-bulk-allowed>false</is-bulk-allowed><is-incremental-allowed>true</is-incremental-allowed><table-name>ct_accreditation_type</table-name><qualifiers type=""array""><qualifier><dataset-attribute-name>rtp</dataset-attribute-name><valid-values type=""array""><valid-value>83</valid-value><valid-value>90</valid-value></valid-values></qualifier></qualifiers><dataset-formats type=""array""><dataset-format><name>xml</name><parser-type>xml</parser-type></dataset-format></dataset-formats></dataset><dataset><id>12</id><name>accreditation level</name><is-bulk-allowed>false</is-bulk-allowed><is-incremental-allowed>false</is-incremental-allowed><table-name>ct_accreditation_level</table-name><qualifiers type=""array""></qualifiers><dataset-formats type=""array""><dataset-format><name>csv</name><parser-type>csv</parser-type></dataset-format></dataset-formats></dataset><dataset><id>11</id><name>accreditation</name><is-bulk-allowed>false</is-bulk-allowed><is-incremental-allowed>false</is-incremental-allowed><table-name>ct_accreditation_level</table-name><qualifiers type=""array""></qualifiers><dataset-formats type=""array""><dataset-format><name>xml</name><parser-type>xml</parser-type></dataset-format></dataset-formats></dataset><dataset><id>31</id><name>ds 01</name><is-bulk-allowed>false</is-bulk-allowed><is-incremental-allowed>true</is-incremental-allowed><table-name>ct_accreditation_level</table-name><qualifiers type=""array""><qualifier><dataset-attribute-name>qual</dataset-attribute-name><valid-values type=""array""><valid-value>11</valid-value><valid-value>54</valid-value></valid-values></qualifier><qualifier><dataset-attribute-name>qual2</dataset-attribute-name><valid-values type=""array""><valid-value>1</valid-value><valid-value>5</valid-value></valid-values></qualifier></qualifiers><dataset-formats type=""array""><dataset-format><name>xml</name><parser-type>xml</parser-type></dataset-format></dataset-formats></dataset></datasets></user-access-group-authorisation>";
            Configuration configuration = new Configuration();
            configuration.BuildFromXml(xml);

            string fileXml = null;
            fileXml = "<rows><row><id>12</id><control_code>110</control_code></row></rows>";
            IntegrityDataset _dataset = configuration.GetDataset(45);
            DatasetFormat _format = _dataset.m_dataset_formats.Find(c => c.name == "xml");
            UploadAttempt _uploadAttempt = new UploadAttempt(_dataset, configuration.GetQualifiersForDataset(45), ref fileXml, _format, UploadAttempt.Type.Incremental);

            string resultXml = null;
            resultXml = _uploadAttempt.BuildAttemptXml();
            StringAssert.AreEqualIgnoringCase("RTP", ((Qualifier)_uploadAttempt.Qualifiers.ToArray().GetValue(0)).AttributeName);

            string expectedXML = null;
            expectedXML = "<upload-attempt><dataset-name>Accreditation Type</dataset-name><format-name>XML</format-name><bulk-or-incremental>incremental</bulk-or-incremental><qualifiers type=\"array\"><qualifier><dataset-attribute-name>RTP</dataset-attribute-name><qualifier-values type=\"array\"><qualifier-value>83</qualifier-value><qualifier-value>90</qualifier-value></qualifier-values></qualifier></qualifiers><file><![CDATA[<rows><row><id>12</id><control_code>110</control_code></row></rows>]]></file></upload-attempt>";

            StringAssert.AreEqualIgnoringCase(expectedXML, resultXml);
        }
开发者ID:C3,项目名称:IntegrityAPIIntegration,代码行数:21,代码来源:UploadAttemptTests.cs

示例5: EmptyConfiguration

 public void EmptyConfiguration()
 {
     Configuration _configuration = new Configuration();
     _configuration.BuildFromXml("<user-access-group-authorisation><datasets type=\"array\"/></user-access-group-authorisation>");
     Assert.AreEqual(_configuration.m_Datasets.Count, 0);
 }
开发者ID:C3,项目名称:IntegrityAPIIntegration,代码行数:6,代码来源:ConfigurationTests.cs

示例6: SingleDatasetConfiguration

 public void SingleDatasetConfiguration()
 {
     Configuration _configuration = new Configuration();
     _configuration.BuildFromXml("<user-access-group-authorisation><datasets type=\"array\">" + "<dataset><id>9</id><name>Dataset name</name><is-bulk-allowed>false</is-bulk-allowed>" + "<is-incremental-allowed>true</is-incremental-allowed><table-name>dataset_name</table-name>" + "<qualifiers type=\"array\"/></dataset></datasets></user-access-group-authorisation>");
     Assert.AreEqual(_configuration.m_Datasets.Count, 1);
 }
开发者ID:C3,项目名称:IntegrityAPIIntegration,代码行数:6,代码来源:ConfigurationTests.cs

示例7: GetDatasetWithFormatsWithLowercaseParserTypes

        public void GetDatasetWithFormatsWithLowercaseParserTypes()
        {
            Configuration _configuration = new Configuration();
            string xmlConfig = @"<user-access-group-authorisation>
                    <datasets type=""array"">
                        <dataset><id>9</id>
                            <name>people</name>
                            <is-bulk-allowed>false</is-bulk-allowed>
                            <is-incremental-allowed>true</is-incremental-allowed>
                            <table-name>dataset_name</table-name>
                            <qualifiers type=""array""/>
                            <dataset-formats type=""array"">
                                <dataset-format>
                                    <name>Countries CSV</name>
                                    <parser-type>csv</parser-type>
                                </dataset-format>
                                <dataset-format>
                                    <name>Countries XML</name>
                                    <parser-type>xml</parser-type>
                                </dataset-format>
                            </dataset-formats>
                        </dataset>
                    </datasets>
                </user-access-group-authorisation>";
            _configuration.BuildFromXml(xmlConfig);
            IntegrityDataset _dataset = _configuration.GetDataset(9);

            Assert.AreEqual(_dataset.m_dataset_formats.Count, 2);

            DatasetFormat csv_format = (DatasetFormat)_dataset.m_dataset_formats.Find(c => c.name == "Countries CSV");
            Assert.NotNull(csv_format);
            Assert.AreEqual(csv_format.type, DatasetFormat.Type.CSV);

            DatasetFormat xml_format = (DatasetFormat)_dataset.m_dataset_formats.Find(c => c.name == "Countries XML");
            Assert.NotNull(xml_format);
            Assert.AreEqual(xml_format.type, DatasetFormat.Type.XML);
        }
开发者ID:C3,项目名称:IntegrityAPIIntegration,代码行数:37,代码来源:ConfigurationTests.cs


注:本文中的Configuration.BuildFromXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。