System.Data.Tests.DataSetTest2.ReadXmlSchema_Nested C# (CSharp) Метод

ReadXmlSchema_Nested() приватный Метод

private ReadXmlSchema_Nested ( ) : void
Результат void
        public void ReadXmlSchema_Nested()
        {
            //when Relation.Nested = false, and the schema is nested, create new relations on <table>_Id
            //columns.
            DataSet ds = new DataSet();
            ds.ReadXmlSchema(new StringReader(
                @"<?xml version=""1.0"" standalone=""yes""?>
                <xs:schema id=""dataset"" xmlns="""" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
                  <xs:element name=""dataset"" msdata:IsDataSet=""true"" msdata:Locale=""en-US"">
                    <xs:complexType>
                      <xs:choice maxOccurs=""unbounded"">
                        <xs:element name=""table1"">
                          <xs:complexType>
                            <xs:sequence>
                              <xs:element name=""col"" type=""xs:string"" minOccurs=""0"" />
                              <xs:element name=""table1_Id"" type=""xs:string"" minOccurs=""0"" />
                              <xs:element name=""table2"" minOccurs=""0"" maxOccurs=""unbounded"">
                                <xs:complexType>
                                  <xs:sequence>
                                    <xs:element name=""col"" type=""xs:string"" minOccurs=""0"" />
                                    <xs:element name=""table1_Id"" type=""xs:string"" minOccurs=""0"" />
                                  </xs:sequence>
                                </xs:complexType>
                              </xs:element>
                            </xs:sequence>
                          </xs:complexType>
                        </xs:element>
                      </xs:choice>
                    </xs:complexType>
                    <xs:unique name=""Constraint1"">
                      <xs:selector xpath="".//table1"" />
                      <xs:field xpath=""col"" />
                    </xs:unique>
                    <xs:keyref name=""rel"" refer=""Constraint1"" msdata:IsNested=""false"">
                      <xs:selector xpath="".//table2"" />
                      <xs:field xpath=""col"" />
                    </xs:keyref>
                  </xs:element>
                </xs:schema>"));
            Assert.Equal(2, ds.Relations.Count);
            Assert.Equal(3, ds.Tables[0].Columns.Count);
            Assert.Equal(3, ds.Tables[1].Columns.Count);
            Assert.Equal("table1_Id_0", ds.Tables[0].Columns[2].ColumnName);
            Assert.Equal("table1_Id_0", ds.Tables[0].PrimaryKey[0].ColumnName);
        }
DataSetTest2