System.Data.Tests.DataSetTest2.WriteXmlSchema_RelationAnnotation C# (CSharp) Метод

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

private WriteXmlSchema_RelationAnnotation ( ) : void
Результат void
        public void WriteXmlSchema_RelationAnnotation()
        {
            DataSet ds1 = new DataSet();

            DataTable table1 = ds1.Tables.Add();
            DataTable table2 = ds1.Tables.Add();

            DataColumn col1_1 = table1.Columns.Add("col1", typeof(int));
            DataColumn col2_1 = table2.Columns.Add("col1", typeof(int));

            ds1.Relations.Add("rel", col1_1, col2_1, false);

            StringWriter sw = new StringWriter();
            ds1.WriteXmlSchema(sw);
            string xml = sw.ToString();


            Assert.True(xml.IndexOf(@"<msdata:Relationship name=""rel"" msdata:parent=""Table1""" +
                        @" msdata:child=""Table2"" msdata:parentkey=""col1"" " +
                        @"msdata:childkey=""col1"" />") != -1, "#1");
        }
DataSetTest2