System.Data.Tests.DataSetReadXmlSchemaTest.IsDataSetAndTypeIgnored C# (CSharp) Метод

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

private IsDataSetAndTypeIgnored ( ) : void
Результат void
        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>";

            // Even if a global element uses a complexType, it will be
            // ignored if the element has msdata:IsDataSet='true'
            string xs = string.Format(xsbase, "true");

            var ds = new DataSet();
            ds.ReadXmlSchema(new StringReader(xs));
            AssertDataSet("ds", ds, "Root", 0, 0); // name is "Root"

            // But when explicit msdata:IsDataSet value is "false", then
            // treat as usual.
            xs = string.Format(xsbase, "false");

            ds = new DataSet();
            ds.ReadXmlSchema(new StringReader(xs));
            AssertDataSet("ds", ds, "NewDataSet", 1, 0);
        }