System.Data.Tests.DataTableTest.ReadXmlSchema_ByStream C# (CSharp) Метод

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

private ReadXmlSchema_ByStream ( ) : void
Результат void
        public void ReadXmlSchema_ByStream()
        {
            DataSet ds1 = new DataSet();
            ds1.Tables.Add(DataProvider.CreateParentDataTable());
            ds1.Tables.Add(DataProvider.CreateChildDataTable());

            MemoryStream ms1 = new MemoryStream();
            MemoryStream ms2 = new MemoryStream();
            //write xml  schema only
            //ds1.WriteXmlSchema (ms);
            ds1.Tables[0].WriteXmlSchema(ms1);
            ds1.Tables[1].WriteXmlSchema(ms2);

            MemoryStream ms11 = new MemoryStream(ms1.GetBuffer());
            MemoryStream ms22 = new MemoryStream(ms2.GetBuffer());
            //copy schema
            //DataSet ds2 = new DataSet ();
            DataTable dt1 = new DataTable();
            DataTable dt2 = new DataTable();

            //ds2.ReadXmlSchema (ms1);
            dt1.ReadXmlSchema(ms11);
            dt2.ReadXmlSchema(ms22);

            //check xml schema
            // ReadXmlSchema - Tables count
            //Assert.Equal (ds2.Tables.Count, ds1.Tables.Count);

            // ReadXmlSchema - Tables 0 Col count
            Assert.Equal(ds1.Tables[0].Columns.Count, dt1.Columns.Count);

            // ReadXmlSchema - Tables 1 Col count
            Assert.Equal(ds1.Tables[1].Columns.Count, dt2.Columns.Count);

            //check some colummns types
            // ReadXmlSchema - Tables 0 Col type
            Assert.Equal(ds1.Tables[0].Columns[0].GetType(), dt1.Columns[0].GetType());

            // ReadXmlSchema - Tables 1 Col type
            Assert.Equal(ds1.Tables[1].Columns[3].GetType(), dt2.Columns[3].GetType());

            //check that no data exists
            // ReadXmlSchema - Table 1 row count
            Assert.Equal(0, dt1.Rows.Count);

            // ReadXmlSchema - Table 2 row count
            Assert.Equal(0, dt2.Rows.Count);
        }
DataTableTest