public void RowError()
{
DataTable dt = new DataTable("myTable");
DataRow dr = dt.NewRow();
Assert.Equal(string.Empty, dr.RowError);
dr.RowError = "Err";
Assert.Equal("Err", dr.RowError);
DataTable dt1 = DataProvider.CreateUniqueConstraint();
Assert.Throws<ConstraintException>(() =>
{
dt1.BeginLoadData();
dr = dt1.NewRow();
dr[0] = 3;
dt1.Rows.Add(dr);
dt1.EndLoadData();
});
Assert.Equal(2, dt1.GetErrors().Length);
Assert.Equal(true, dt1.GetErrors()[0].RowError.Length > 10);
Assert.Equal(true, dt1.GetErrors()[1].RowError.Length > 10);
DataSet ds = DataProvider.CreateForigenConstraint();
Assert.Throws<ConstraintException>(() =>
{
ds.Tables[0].BeginLoadData();
ds.Tables[0].Rows[0][0] = 10; //Forigen constraint violation
//ds.Tables[0].AcceptChanges();
ds.Tables[0].EndLoadData();
});
Assert.Equal(3, ds.Tables[1].GetErrors().Length);
for (int index = 0; index < 3; index++)
{
Assert.Equal(true, ds.Tables[1].GetErrors()[index].RowError.Length > 10);
}
}