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

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

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

            table2.Constraints.Add("fk", col1_1, col2_1);

            StringWriter sw1 = new StringWriter();
            ds1.Tables[0].WriteXmlSchema(sw1);
            string xml1 = sw1.ToString();
            Assert.True(xml1.IndexOf(@"<xs:unique name=""Constraint1"">") != -1);

            StringWriter sw2 = new StringWriter();
            ds1.Tables[1].WriteXmlSchema(sw2);
            string xml2 = sw2.ToString();
            Assert.True(xml2.IndexOf(@"<xs:unique name=""Constraint1"">") == -1);
        }
DataTableTest