public void Merge_PrimaryKeys_IncorrectOrder()
{
Assert.Throws<DataException>(() =>
{
var ds = new DataSet();
DataTable table1 = ds.Tables.Add("table1");
DataTable table2 = ds.Tables.Add("table2");
DataColumn pcol = table1.Columns.Add("col1", typeof(int));
DataColumn pcol1 = table1.Columns.Add("col2", typeof(int));
DataColumn ccol = table2.Columns.Add("col1", typeof(int));
DataSet ds1 = ds.Copy();
table1.PrimaryKey = new DataColumn[] { pcol, pcol1 };
ds1.Tables[0].PrimaryKey = new DataColumn[] { ds1.Tables[0].Columns[1], ds1.Tables[0].Columns[0] };
// Though the key columns are the same, if the order is incorrect
// Exception must be raised
ds1.Merge(ds);
});
}