All pastes #256527 Raw Edit

Nagappan

public text v1 · immutable
#256527 ·published 2006-11-24 10:34 UTC
rendered paste body
                [Test]
                //[Category ("NotWorking")]
                public void ReadWriteXmlSchema_2 () {
                        DataSet ds = new DataSet ("dataset");
                        ds.Tables.Add ("table1");
                        ds.Tables.Add ("table2");
                        ds.Tables[0].Columns.Add ("col");
                        ds.Tables[1].Columns.Add ("col");
                        ds.Relations.Add ("rel", ds.Tables[0].Columns[0], ds.Tables[1].Columns[0], true);

                        MemoryStream ms1 = new MemoryStream ();
                        ds.Tables[0].WriteXmlSchema (ms1);
                        TextWriter writer = new StringWriter ();
                        ds.Tables[0].WriteXmlSchema (writer);
                        Console.WriteLine (writer.ToString ());
                        TextWriter writer1 = new StringWriter ();
                        ds.Tables[1].WriteXmlSchema (writer1);
                        Console.WriteLine (writer1.ToString ());
                        MemoryStream ms2 = new MemoryStream ();
                        ds.Tables[1].WriteXmlSchema (ms2);

                        DataSet ds1 = new DataSet ();
                        ds1.Tables.Add ();
                        ds1.Tables.Add ();
                        ds1.Tables[0].ReadXmlSchema (new MemoryStream (ms1.GetBuffer ()));
                        ds1.Tables[1].ReadXmlSchema (new MemoryStream (ms2.GetBuffer ()));

                        AssertEquals ("#1", 0, ds1.Relations.Count);
                        AssertEquals ("#2", 1, ds1.Tables[0].Columns.Count);
                        AssertEquals ("#3", 1, ds1.Tables[1].Columns.Count);
                }