public void TestSampleFileComplexTables()
{
// Nested simple type element
var ds = new DataSet();
ds.ReadXmlSchema(new StringReader(
@"<!-- nested tables, root references to complex type -->
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:foo' xmlns:x='urn:foo'>
<xs:element name='uno' type='x:t' />
<xs:complexType name='t'>
<xs:sequence>
<xs:element name='des'>
<xs:complexType>
<xs:sequence>
<xs:element name='tres' />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>"));
AssertDataSet("007", ds, "NewDataSet", 2, 1);
DataTable dt = ds.Tables[0];
AssertDataTable("tab1", dt, "uno", 1, 0, 0, 1, 1, 1);
AssertDataColumn("id", dt.Columns[0], "uno_Id", false, true, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, true);
dt = ds.Tables[1];
AssertDataTable("tab2", dt, "des", 2, 0, 1, 0, 1, 0);
AssertDataColumn("child", dt.Columns[0], "tres", false, false, 0, 1, "tres", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
AssertDataColumn("id", dt.Columns[1], "uno_Id", true, false, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
// External simple type element
ds = new DataSet();
ds.ReadXmlSchema(new StringReader(
@"<!-- reference to external simple element -->
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:foo' xmlns:x='urn:foo'>
<xs:element name='uno' type='x:t' />
<xs:element name='tres' type='xs:string' />
<xs:complexType name='t'>
<xs:sequence>
<xs:element name='des'>
<xs:complexType>
<xs:sequence>
<xs:element ref='x:tres' />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>"));
AssertDataSet("008", ds, "NewDataSet", 2, 1);
dt = ds.Tables[0];
AssertDataTable("tab1", dt, "uno", 1, 0, 0, 1, 1, 1);
AssertDataColumn("id", dt.Columns[0], "uno_Id", false, true, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, true);
dt = ds.Tables[1];
AssertDataTable("tab2", dt, "des", 2, 0, 1, 0, 1, 0);
AssertDataColumn("child", dt.Columns[0], "tres", false, false, 0, 1, "tres", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, false);
AssertDataColumn("id", dt.Columns[1], "uno_Id", true, false, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
}