AssertDataTable() public method

public AssertDataTable ( string label, DataTable dt, string name, int columnCount, int rowCount, int parentRelationCount, int childRelationCount, int constraintCount, int primaryKeyLength ) : void
label string
dt DataTable
name string
columnCount int
rowCount int
parentRelationCount int
childRelationCount int
constraintCount int
primaryKeyLength int
return void
Beispiel #1
0
        public void RepeatableSimpleElement()
        {
            var ds = new DataSet();

            ds.ReadXmlSchema(new StringReader(
                                 @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
                  <!-- empty -->
                  <xs:element name='Foo' type='FooType' />
                  <!-- defining externally to avoid being regarded as dataset element -->
                  <xs:complexType name='FooType'>
                    <xs:sequence>
                        <xs:element name='Bar' maxOccurs='2' />
                    </xs:sequence>
                  </xs:complexType>
                </xs:schema>"));
            DataSetAssertion.AssertDataSet("012", ds, "NewDataSet", 2, 1);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("parent", dt, "Foo", 1, 0, 0, 1, 1, 1);
            DataSetAssertion.AssertDataColumn("key", dt.Columns[0], "Foo_Id", false, true, 0, 1, "Foo_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true);

            dt = ds.Tables[1];
            DataSetAssertion.AssertDataTable("repeated", dt, "Bar", 2, 0, 1, 0, 1, 0);
            DataSetAssertion.AssertDataColumn("data", dt.Columns[0], "Bar_Column", false, false, 0, 1, "Bar_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("refkey", dt.Columns[1], "Foo_Id", true, false, 0, 1, "Foo_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);

            DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "Foo_Bar", true, new string[] { "Foo_Id" }, new string[] { "Foo_Id" }, true, true);
        }
Beispiel #2
0
        public void LocaleOnRootWithoutIsDataSet()
        {
            using (new ThreadCultureChange("fi-FI"))
            {
                string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
<xs:element name='Root' msdata:Locale='ja-JP'>
    <xs:complexType>
        <xs:sequence>
            <xs:element name='Child' type='xs:string' />
        </xs:sequence>
        <xs:attribute name='Attr' type='xs:integer' />
    </xs:complexType>
</xs:element>
</xs:schema>";

                var ds = new DataSet();
                ds.ReadXmlSchema(new StringReader(xs));
                DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
                Assert.Equal("fi-FI", ds.Locale.Name); // DataSet's Locale comes from current thread
                DataTable dt = ds.Tables[0];
                DataSetAssertion.AssertDataTable("dt", dt, "Root", 2, 0, 0, 0, 0, 0);
                Assert.Equal("ja-JP", dt.Locale.Name); // DataTable's Locale comes from msdata:Locale
                DataSetAssertion.AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
                DataSetAssertion.AssertDataColumn("col2", dt.Columns[1], "Child", false, false, 0, 1, "Child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
            }
        }
Beispiel #3
0
        public void IsDataSetAndTypeIgnored()
        {
            string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
    <xs:element name='Root' type='unusedType' msdata:IsDataSet='{0}'>
    </xs:element>
    <xs:complexType name='unusedType'>
        <xs:sequence>
            <xs:element name='Child' type='xs:string' />
        </xs:sequence>
    </xs:complexType>
</xs:schema>";

            AssertExtensions.Throws <ArgumentException>(null, () =>
            {
                // When explicit msdata:IsDataSet value is "false", then
                // treat as usual.
                string xs = string.Format(xsbase, "false");
                var ds    = new DataSet();
                ds.Tables.Add(new DataTable("Root"));
                ds.Tables[0].ReadXmlSchema(new StringReader(xs));
                DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);

                // Even if a global element uses a complexType, it will be
                // ignored if the element has msdata:IsDataSet='true'
                xs = string.Format(xsbase, "true");
                ds = new DataSet();
                ds.Tables.Add(new DataTable("Root"));
                ds.Tables[0].ReadXmlSchema(new StringReader(xs));
            });
        }
Beispiel #4
0
        public void TestSampleFileComplexTables3()
        {
            var ds = new DataSet();

            ds.Tables.Add(new DataTable("e"));
            ds.Tables[0].ReadXmlSchema(new StringReader(
                                           @"<!-- Modified w3ctests attQ014.xsd -->
                <xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" targetNamespace=""http://xsdtesting"" xmlns:x=""http://xsdtesting"">
                    <xsd:element name=""root"">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name=""e"">
                                    <xsd:complexType>
                                        <xsd:simpleContent>
                                            <xsd:extension base=""xsd:decimal"">
                                                <xsd:attribute name=""a"" type=""xsd:string""/>
                                            </xsd:extension>
                                        </xsd:simpleContent>
                                    </xsd:complexType>
                                </xsd:element>
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                </xsd:schema>"));
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("root", dt, "e", 2, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("attr", dt.Columns[0], "a", true, false, 0, 1, "a", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("simple", dt.Columns[1], "e_text", false, false, 0, 1, "e_text", MappingType.SimpleContent, typeof(decimal), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
        }
Beispiel #5
0
        public void SequentialRead2()
        {
            // simple element -> simple dataset
            var ds = new DataSet();

            DataSetAssertion.AssertReadXml(ds, "SingleText", xml5,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "root", 0);

            DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("#1", ds.Tables[0], "root", 2, 1, 0, 0, 0, 0);

            // simple table -> simple dataset
            ds = new DataSet();

            DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("#2", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0);

            // Return value became IgnoreSchema, since there is
            // already schema information in the dataset.
            // Columns are kept 1 as old table holds.
            // Rows are up to 2 because of accumulative read.
            DataSetAssertion.AssertReadXml(ds, "SimpleTable2-2", xml7,
                                           XmlReadMode.Auto, XmlReadMode.IgnoreSchema,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("#3", ds.Tables[0], "root", 1, 2, 0, 0, 0, 0);
        }
Beispiel #6
0
        public void UnusedComplexTypesIgnored()
        {
            string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
    <xs:element name='Root'>
        <xs:complexType>
            <xs:sequence>
                <xs:element name='Child' type='xs:string' />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name='unusedType'>
        <xs:sequence>
            <xs:element name='Orphan' type='xs:string' />
        </xs:sequence>
    </xs:complexType>
</xs:schema>";

            AssertExtensions.Throws <ArgumentException>(null, () =>
            {
                var ds = new DataSet();
                ds.Tables.Add(new DataTable("Root"));
                ds.Tables.Add(new DataTable("unusedType"));
                ds.Tables[0].ReadXmlSchema(new StringReader(xs));
                DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);
                // Here "unusedType" table is never imported.
                ds.Tables[1].ReadXmlSchema(new StringReader(xs));
            });
        }
Beispiel #7
0
        public void PrefixedTargetNS()
        {
            string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:x='urn:foo' targetNamespace='urn:foo' elementFormDefault='qualified'>
    <xs:element name='DS' msdata:IsDataSet='true'>
        <xs:complexType>
            <xs:choice>
                <xs:element ref='x:R1' />
                <xs:element ref='x:R2' />
            </xs:choice>
        </xs:complexType>
        <xs:key name='key'>
            <xs:selector xpath='./any/string_is_OK/x:R1'/>
            <xs:field xpath='x:Child2'/>
        </xs:key>
        <xs:keyref name='kref' refer='x:key'>
            <xs:selector xpath='.//x:R2'/>
            <xs:field xpath='x:Child2'/>
        </xs:keyref>
    </xs:element>
    <xs:element name='R3' type='x:RootType' />
    <xs:complexType name='extracted'>
        <xs:choice>
            <xs:element ref='x:R1' />
            <xs:element ref='x:R2' />
        </xs:choice>
    </xs:complexType>
    <xs:element name='R1' type='x:RootType'>
        <xs:unique name='Rkey'>
            <xs:selector xpath='.//x:Child1'/>
            <xs:field xpath='.'/>
        </xs:unique>
        <xs:keyref name='Rkref' refer='x:Rkey'>
            <xs:selector xpath='.//x:Child2'/>
            <xs:field xpath='.'/>
        </xs:keyref>
    </xs:element>
    <xs:element name='R2' type='x:RootType'>
    </xs:element>
    <xs:complexType name='RootType'>
        <xs:choice>
            <xs:element name='Child1' type='xs:string'>
            </xs:element>
            <xs:element name='Child2' type='xs:string' />
        </xs:choice>
        <xs:attribute name='Attr' type='xs:integer' />
    </xs:complexType>
</xs:schema>";
            // No prefixes on tables and columns
            var ds = new DataSet();

            ds.Tables.Add(new DataTable("R3"));
            ds.Tables[0].ReadXmlSchema(new StringReader(xs));
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("R3", dt, "R3", 3, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
        }
Beispiel #8
0
        public void ReadSimpleAuto()
        {
            DataSet ds;

            // empty XML
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "EmptyString", xml1,
                                           XmlReadMode.Auto, XmlReadMode.Auto,
                                           "NewDataSet", 0);

            // simple element
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "EmptyElement", xml2,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "root", 0);

            // simple element2
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "StartEndTag", xml3,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "root", 0);

            // whitespace in simple element
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "Whitespace", xml4,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "root", 0);

            // text in simple element
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "SingleText", xml5,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "root", 0);

            // simple table pattern:
            // root becomes a table and test becomes a column.
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("xml6", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0);

            // simple table with 2 columns:
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("xml7", ds.Tables[0], "root", 2, 1, 0, 0, 0, 0);

            // simple dataset with 1 table:
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "SimpleDataSet", xml8,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "dataset", 1);
            DataSetAssertion.AssertDataTable("xml8", ds.Tables[0], "table", 2, 1, 0, 0, 0, 0);
        }
Beispiel #9
0
        public void SingleElementWithAttribute()
        {
            DataSet ds = GetDataSet(_xml2, null);

            DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
        }
Beispiel #10
0
        public void SimpleDataSet()
        {
            DataSet ds = GetDataSet(_xml8, null);

            DataSetAssertion.AssertDataSet("ds", ds, "set", 1, 0);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("dt", dt, "tab", 3, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "col1", true, false, 0, 1, "col1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("col2", dt.Columns[1], "col2", true, false, 0, 1, "col2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("col3", dt.Columns[2], "col3", true, false, 0, 1, "col3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false);
        }
Beispiel #11
0
        public void MixedContent()
        {
            // Note that text part is ignored.

            DataSet ds = GetDataSet(_xml10, null);

            DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "b", true, false, 0, 1, "b", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
        }
Beispiel #12
0
        public void SignificantWhitespaceIgnored()
        {
            // Note that 1) significant whitespace is ignored, and
            // 2) xml:space is treated as column (and also note namespaces).
            DataSet ds = GetDataSet(_xml11, null);

            DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("element", dt.Columns[0], "child_after_significant_space", true, false, 0, 1, "child_after_significant_space", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            Assert.Equal(1, dt.Columns.Count);
        }
Beispiel #13
0
        public void TestAnnotatedRelation2()
        {
            var ds = new DataSet();

            ds.ReadXmlSchema(new StringReader(
                                 @"<xs:schema xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
                <!-- just modified MSDN example -->
                <xs:element name=""ds"" msdata:IsDataSet=""true"">
                 <xs:complexType>
                  <xs:choice maxOccurs=""unbounded"">
                   <xs:element name=""p"">
                    <xs:complexType>
                     <xs:sequence>
                       <xs:element name=""pk"" type=""xs:string"" />
                       <xs:element name=""name"" type=""xs:string"" />
                       <xs:element name=""c"">
                          <xs:annotation>
                           <xs:appinfo>
                            <msdata:Relationship name=""rel""
                             msdata:parent=""p""
                             msdata:child=""c""
                             msdata:parentkey=""pk""
                             msdata:childkey=""fk""/>
                           </xs:appinfo>
                          </xs:annotation>
                          <xs:complexType>
                            <xs:sequence>
                             <xs:element name=""fk"" type=""xs:string"" />
                             <xs:element name=""count"" type=""xs:int"" />
                            </xs:sequence>
                         </xs:complexType>
                       </xs:element>
                     </xs:sequence>
                    </xs:complexType>
                   </xs:element>
                  </xs:choice>
                 </xs:complexType>
                </xs:element>
                </xs:schema>"));
            DataSetAssertion.AssertDataSet("102", ds, "ds", 2, 1);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("parent_table", dt, "p", 2, 0, 0, 1, 0, 0);
            DataSetAssertion.AssertDataColumn("pk", dt.Columns[0], "pk", false, false, 0, 1, "pk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);

            dt = ds.Tables[1];
            DataSetAssertion.AssertDataTable("child_table", dt, "c", 2, 0, 1, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("fk", dt.Columns[0], "fk", false, false, 0, 1, "fk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);

            DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "rel", true, new string[] { "pk" }, new string[] { "fk" }, false, false);
        }
Beispiel #14
0
        public void SequentialRead1()
        {
            // simple element -> simple table
            var ds = new DataSet();

            DataSetAssertion.AssertReadXml(ds, "SingleText", xml5,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "root", 0);

            DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6,
                                           XmlReadMode.Auto, XmlReadMode.InferSchema,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("seq1", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0);
        }
Beispiel #15
0
        public void IgnoredNamespaces()
        {
            string  xml = "<root attr='val' xmlns:a='urn:foo' a:foo='hogehoge' />";
            DataSet ds  = new DataSet();

            ds.InferXmlSchema(new StringReader(xml), null);
            DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
            DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "root", 2, 0, 0, 0, 0, 0);

            ds = new DataSet();
            ds.InferXmlSchema(new StringReader(xml), new string[] { "urn:foo" });
            DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
            // a:foo is ignored
            DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "root", 1, 0, 0, 0, 0, 0);
        }
Beispiel #16
0
        public void SingleChild()
        {
            DataSet ds = GetDataSet(_xml5, null);

            DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "child", true, false, 0, 1, "child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);

            ds = GetDataSet(_xml6, null);
            DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
            dt = ds.Tables[0];
            DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "col1", true, false, 0, 1, "col1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
        }
Beispiel #17
0
        private void ReadTest1Check(DataSet ds)
        {
            DataSetAssertion.AssertDataSet("dataset", ds, "NewDataSet", 2, 1);
            DataSetAssertion.AssertDataTable("tbl1", ds.Tables[0], "Table1", 3, 0, 0, 1, 1, 0);
            DataSetAssertion.AssertDataTable("tbl2", ds.Tables[1], "Table2", 3, 0, 1, 0, 1, 0);

            DataRelation rel = ds.Relations[0];

            DataSetAssertion.AssertDataRelation("rel", rel, "Rel1", false,
                                                new string[] { "Column1_3" },
                                                new string[] { "Column2_1" }, true, true);
            DataSetAssertion.AssertUniqueConstraint("uc", rel.ParentKeyConstraint,
                                                    "Constraint1", false, new string[] { "Column1_3" });
            DataSetAssertion.AssertForeignKeyConstraint("fk", rel.ChildKeyConstraint, "Rel1",
                                                        AcceptRejectRule.None, Rule.Cascade, Rule.Cascade,
                                                        new string[] { "Column2_1" },
                                                        new string[] { "Column1_3" });
        }
Beispiel #18
0
        public void TwoElementTable()
        {
            // FIXME: Also test ReadXml (, XmlReadMode.InferSchema) and
            // make sure that ReadXml() stores DataRow to el1 (and maybe to others)
            DataSet ds = GetDataSet(_xml15, null);

            DataSetAssertion.AssertDataSet("ds", ds, "root", 2, 0);

            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("dt", dt, "table1", 2, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("col1_1", dt.Columns[0], "col1_1", true, false, 0, 1, "col1_1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("col1_2", dt.Columns[1], "col1_2", true, false, 0, 1, "col1_2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);

            dt = ds.Tables[1];
            DataSetAssertion.AssertDataTable("dt", dt, "table2", 2, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("col2_1", dt.Columns[0], "col2_1", true, false, 0, 1, "col2_1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("col2_2", dt.Columns[1], "col2_2", true, false, 0, 1, "col2_2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
        }
Beispiel #19
0
        public void TestSimpleSchemaPlusContentAll()
        {
            DataSet ds;

            // ignored
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "IgnoreSchema", schema2,
                                           XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema,
                                           "NewDataSet", 0, ReadState.Interactive);

            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "InferSchema", schema2,
                                           XmlReadMode.InferSchema, XmlReadMode.InferSchema,
                                           "NewDataSet", 0, ReadState.Interactive);

            // Fragment ... consumed both
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "Fragment", schema2,
                                           XmlReadMode.Fragment, XmlReadMode.Fragment,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("fragment", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);

            // rest ... treated as schema
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "Auto", schema2,
                                           XmlReadMode.Auto, XmlReadMode.ReadSchema,
                                           "NewDataSet", 1, ReadState.Interactive);
            DataSetAssertion.AssertDataTable("auto", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);

            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "DiffGram", schema2,
                                           XmlReadMode.DiffGram, XmlReadMode.DiffGram,
                                           "NewDataSet", 1, ReadState.Interactive);
            DataSetAssertion.AssertDataTable("diffgram", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);

            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "ReadSchema", schema2,
                                           XmlReadMode.ReadSchema, XmlReadMode.ReadSchema,
                                           "NewDataSet", 1, ReadState.Interactive);
        }
Beispiel #20
0
        public void TestSimpleSchemaXmlAll()
        {
            DataSet ds;

            // ignored
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "IgnoreSchema", schema1,
                                           XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema,
                                           "NewDataSet", 0);

            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "InferSchema", schema1,
                                           XmlReadMode.InferSchema, XmlReadMode.InferSchema,
                                           "NewDataSet", 0);

            // misc ... consume schema
            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "Fragment", schema1,
                                           XmlReadMode.Fragment, XmlReadMode.Fragment,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("fragment", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);

            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "ReadSchema", schema1,
                                           XmlReadMode.ReadSchema, XmlReadMode.ReadSchema,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("readschema", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);

            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "Auto", schema1,
                                           XmlReadMode.Auto, XmlReadMode.ReadSchema,
                                           "NewDataSet", 1);
            DataSetAssertion.AssertDataTable("auto", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);

            ds = new DataSet();
            DataSetAssertion.AssertReadXml(ds, "DiffGram", schema1,
                                           XmlReadMode.DiffGram, XmlReadMode.DiffGram,
                                           "NewDataSet", 1);
        }
Beispiel #21
0
        public void ConflictColumnTable()
        {
            DataSet ds = GetDataSet(_xml19, null);

            DataSetAssertion.AssertDataSet("ds", ds, "set", 2, 1);

            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("dt", dt, "table", 1, 0, 0, 1, 1, 1);
            DataSetAssertion.AssertDataColumn("table_Id", dt.Columns[0], "table_Id", false, true, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true);

            dt = ds.Tables[1];
            DataSetAssertion.AssertDataTable("dt", dt, "col", 2, 0, 1, 0, 1, 0);
            DataSetAssertion.AssertDataColumn("table_refId", dt.Columns["table_Id"], "table_Id", true, false, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, /*0*/ -1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("another_col", dt.Columns["another_col"], "another_col", true, false, 0, 1, "another_col", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*1*/ -1, string.Empty, false, false);

            DataRelation dr = ds.Relations[0];

            DataSetAssertion.AssertDataRelation("rel", dr, "table_col", true, new string[] { "table_Id" }, new string[] { "table_Id" }, true, true);
            DataSetAssertion.AssertUniqueConstraint("uniq", dr.ParentKeyConstraint, "Constraint1", true, new string[] { "table_Id" });
            DataSetAssertion.AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" });
        }
Beispiel #22
0
        public void TestSampleFileSimpleTables()
        {
            var ds = new DataSet();

            ds.Tables.Add(new DataTable("foo"));
            ds.Tables[0].ReadXmlSchema(new StringReader(
                                           @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
                <xs:element name='foo' type='ct' />
                <xs:complexType name='ct'>
                  <xs:simpleContent>
                    <xs:extension base='xs:integer'>
                      <xs:attribute name='attr' />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
                </xs:schema>"));
            DataSetAssertion.AssertDataSet("005", ds, "NewDataSet", 1, 0);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("attr", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("text", dt.Columns[1], "foo_text", false, false, 0, 1, "foo_text", MappingType.SimpleContent, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);

            ds = new DataSet();
            ds.Tables.Add(new DataTable("foo"));
            ds.Tables[0].ReadXmlSchema(new StringReader(
                                           @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
                    <xs:element name='foo' type='st' />
                    <xs:complexType name='st'>
                      <xs:attribute name='att1' />
                      <xs:attribute name='att2' type='xs:int' default='2' />
                    </xs:complexType>
                </xs:schema>"));
            DataSetAssertion.AssertDataSet("006", ds, "NewDataSet", 1, 0);
            dt = ds.Tables[0];
            DataSetAssertion.AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0);
            DataSetAssertion.AssertDataColumn("att1", dt.Columns["att1"], "att1", true, false, 0, 1, "att1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*0*/ -1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("att2", dt.Columns["att2"], "att2", true, false, 0, 1, "att2", MappingType.Attribute, typeof(int), 2, string.Empty, -1, string.Empty, /*1*/ -1, string.Empty, false, false);
        }
Beispiel #23
0
        public void TestMoreThanOneRepeatableColumns()
        {
            var ds = new DataSet();

            ds.ReadXmlSchema(new StringReader(
                                 @"<xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
                    <xsd:element name=""root"">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name=""x"" maxOccurs=""2"" />
                                <xsd:element ref=""y"" maxOccurs=""unbounded"" />
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                    <xsd:element name=""y"" />
                </xsd:schema>"));
            DataSetAssertion.AssertDataSet("014", ds, "NewDataSet", 3, 2);

            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("parent", dt, "root", 1, 0, 0, 2, 1, 1);
            DataSetAssertion.AssertDataColumn("key", dt.Columns[0], "root_Id", false, true, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true);

            dt = ds.Tables[1];
            DataSetAssertion.AssertDataTable("repeated", dt, "x", 2, 0, 1, 0, 1, 0);
            DataSetAssertion.AssertDataColumn("data_1", dt.Columns[0], "x_Column", false, false, 0, 1, "x_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("refkey_1", dt.Columns[1], "root_Id", true, false, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);

            dt = ds.Tables[2];
            DataSetAssertion.AssertDataTable("repeated", dt, "y", 2, 0, 1, 0, 1, 0);
            DataSetAssertion.AssertDataColumn("data", dt.Columns[0], "y_Column", false, false, 0, 1, "y_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("refkey", dt.Columns[1], "root_Id", true, false, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);

            DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "root_x", true, new string[] { "root_Id" }, new string[] { "root_Id" }, true, true);

            DataSetAssertion.AssertDataRelation("rel", ds.Relations[1], "root_y", true, new string[] { "root_Id" }, new string[] { "root_Id" }, true, true);
        }
Beispiel #24
0
        public void ComplexElementAttributeTable1()
        {
            // FIXME: Also test ReadXml (, XmlReadMode.InferSchema) and
            // make sure that ReadXml() stores DataRow to el1 (and maybe to others)
            DataSet ds = GetDataSet(_xml9, null);

            DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 4, 3);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("dt1", dt, "el1", 3, 0, 0, 1, 1, 1);
            DataSetAssertion.AssertDataColumn("el1_Id", dt.Columns[0], "el1_Id", false, true, 0, 1, "el1_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true);
            DataSetAssertion.AssertDataColumn("el1_attr1", dt.Columns[1], "attr1", true, false, 0, 1, "attr1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el1_attrA", dt.Columns[2], "attrA", true, false, 0, 1, "attrA", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false);

            dt = ds.Tables[1];
            DataSetAssertion.AssertDataTable("dt2", dt, "el2", 6, 0, 1, 2, 2, 1);
            DataSetAssertion.AssertDataColumn("el2_Id", dt.Columns[0], "el2_Id", false, true, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true);
            DataSetAssertion.AssertDataColumn("el2_col2", dt.Columns[1], "column2", true, false, 0, 1, "column2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el2_col3", dt.Columns[2], "column3", true, false, 0, 1, "column3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el2_attr2", dt.Columns[3], "attr2", true, false, 0, 1, "attr2", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el2_attrB", dt.Columns[4], "attrB", true, false, 0, 1, "attrB", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 4, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el2_el1Id", dt.Columns[5], "el1_Id", true, false, 0, 1, "el1_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 5, string.Empty, false, false);

            dt = ds.Tables[2];
            DataSetAssertion.AssertDataTable("dt3", dt, "el3", 4, 0, 1, 0, 1, 0);
            DataSetAssertion.AssertDataColumn("el3_attr3", dt.Columns[0], "attr3", true, false, 0, 1, "attr3", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el3_attrC", dt.Columns[1], "attrC", true, false, 0, 1, "attrC", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el3_Text", dt.Columns[2], "el3_Text", true, false, 0, 1, "el3_Text", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el3_el2Id", dt.Columns[3], "el2_Id", true, false, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false);

            dt = ds.Tables[3];
            DataSetAssertion.AssertDataTable("dt4", dt, "el4", 4, 0, 1, 0, 1, 0);
            DataSetAssertion.AssertDataColumn("el3_attr4", dt.Columns[0], "attr4", true, false, 0, 1, "attr4", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el4_attrD", dt.Columns[1], "attrD", true, false, 0, 1, "attrD", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el4_Text", dt.Columns[2], "el4_Text", true, false, 0, 1, "el4_Text", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("el4_el2Id", dt.Columns[3], "el2_Id", true, false, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false);
        }
Beispiel #25
0
        public void UnusedComplexTypesIgnored()
        {
            string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
    <xs:element name='Root'>
        <xs:complexType>
            <xs:sequence>
                <xs:element name='Child' type='xs:string' />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name='unusedType'>
        <xs:sequence>
            <xs:element name='Orphan' type='xs:string' />
        </xs:sequence>
    </xs:complexType>
</xs:schema>";

            var ds = new DataSet();

            ds.ReadXmlSchema(new StringReader(xs));
            // Here "unusedType" table is never imported.
            DataSetAssertion.AssertDataSet("ds", ds, "hoge", 1, 0);
            DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);
        }
Beispiel #26
0
        public void SuspiciousDataSetElement()
        {
            string schema = @"<?xml version='1.0'?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
    <xsd:attribute name='foo' type='xsd:string'/>
    <xsd:attribute name='bar' type='xsd:string'/>
    <xsd:complexType name='attRef'>
        <xsd:attribute name='att1' type='xsd:int'/>
        <xsd:attribute name='att2' type='xsd:string'/>
    </xsd:complexType>
    <xsd:element name='doc'>
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name='elem' type='attRef'/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>";
            var    ds     = new DataSet();

            ds.Tables.Add(new DataTable("elem"));
            ds.Tables[0].ReadXmlSchema(new StringReader(schema));
            DataSetAssertion.AssertDataTable("table", ds.Tables[0], "elem", 2, 0, 0, 0, 0, 0);
        }
Beispiel #27
0
        public void SingleElementTreatmentDifference()
        {
            // This is one of the most complicated case. When the content
            // type particle of 'Root' element is a complex element, it
            // is DataSet element. Otherwise, it is just a data table.
            //
            // But also note that there is another test named
            // LocaleOnRootWithoutIsDataSet(), that tests if locale on
            // the (mere) data table modifies *DataSet's* locale.

            // Moreover, when the schema contains another element
            // (regardless of its schema type), the elements will
            // never be treated as a DataSet.
            string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
    <xs:element name='Root'> <!-- When simple, it becomes table. When complex, it becomes DataSet -->
        <xs:complexType>
            <xs:choice>
                {0}
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>";

            string xsbase2 = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
    <xs:element name='Root'> <!-- When simple, it becomes table. When complex, it becomes DataSet -->
        <xs:complexType>
            <xs:choice>
                {0}
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:element name='more' type='xs:string' />
</xs:schema>";

            string simple  = "<xs:element name='Child' type='xs:string' />";
            string complex = @"<xs:element name='Child'>
    <xs:complexType>
        <xs:attribute name='a1' />
        <xs:attribute name='a2' type='xs:integer' />
    </xs:complexType>
</xs:element>";
            string elref   = "<xs:element ref='more' />";

            string xs2 = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
    <xs:element name='Root' type='RootType' />
    <xs:complexType name='RootType'>
        <xs:choice>
            <xs:element name='Child'>
                <xs:complexType>
                    <xs:attribute name='a1' />
                    <xs:attribute name='a2' type='xs:integer' />
                </xs:complexType>
            </xs:element>
        </xs:choice>
    </xs:complexType>
</xs:schema>";

            var ds = new DataSet();

            string xs = string.Format(xsbase, simple);

            ds.ReadXmlSchema(new StringReader(xs));
            DataSetAssertion.AssertDataSet("simple", ds, "hoge", 1, 0);
            DataSetAssertion.AssertDataTable("simple", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);

            // reference to global complex type
            ds = new DataSet();
            ds.ReadXmlSchema(new StringReader(xs2));
            DataSetAssertion.AssertDataSet("external complexType", ds, "hoge", 2, 1);
            DataSetAssertion.AssertDataTable("external Tab1", ds.Tables[0], "Root", 1, 0, 0, 1, 1, 1);
            DataSetAssertion.AssertDataTable("external Tab2", ds.Tables[1], "Child", 3, 0, 1, 0, 1, 0);

            // xsbase2 + complex -> datatable
            ds = new DataSet();
            xs = string.Format(xsbase2, complex);
            ds.ReadXmlSchema(new StringReader(xs));
            DataSetAssertion.AssertDataSet("complex", ds, "hoge", 2, 1);
            DataSetAssertion.AssertDataTable("complex", ds.Tables[0], "Root", 1, 0, 0, 1, 1, 1);
            DataTable dt = ds.Tables[1];

            DataSetAssertion.AssertDataTable("complex", dt, "Child", 3, 0, 1, 0, 1, 0);
            DataSetAssertion.AssertDataColumn("a1", dt.Columns["a1"], "a1", true, false, 0, 1, "a1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*0*/ -1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("a2", dt.Columns["a2"], "a2", true, false, 0, 1, "a2", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, /*1*/ -1, string.Empty, false, false);
            DataSetAssertion.AssertDataColumn("Root_Id", dt.Columns[2], "Root_Id", true, false, 0, 1, "Root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false);

            // xsbase + complex -> dataset
            ds = new DataSet();
            xs = string.Format(xsbase, complex);
            ds.ReadXmlSchema(new StringReader(xs));
            DataSetAssertion.AssertDataSet("complex", ds, "Root", 1, 0);

            ds = new DataSet();
            xs = string.Format(xsbase2, elref);
            ds.ReadXmlSchema(new StringReader(xs));
            DataSetAssertion.AssertDataSet("complex", ds, "hoge", 1, 0);
            DataSetAssertion.AssertDataTable("complex", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);
        }
Beispiel #28
0
        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>"));
            DataSetAssertion.AssertDataSet("007", ds, "NewDataSet", 2, 1);
            DataTable dt = ds.Tables[0];

            DataSetAssertion.AssertDataTable("tab1", dt, "uno", 1, 0, 0, 1, 1, 1);
            DataSetAssertion.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];
            DataSetAssertion.AssertDataTable("tab2", dt, "des", 2, 0, 1, 0, 1, 0);
            DataSetAssertion.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);
            DataSetAssertion.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>"));
            DataSetAssertion.AssertDataSet("008", ds, "NewDataSet", 2, 1);
            dt = ds.Tables[0];
            DataSetAssertion.AssertDataTable("tab1", dt, "uno", 1, 0, 0, 1, 1, 1);
            DataSetAssertion.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];
            DataSetAssertion.AssertDataTable("tab2", dt, "des", 2, 0, 1, 0, 1, 0);
            DataSetAssertion.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);
            DataSetAssertion.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);
        }