public void AllowNew()
{
DataTable dt = DataProvider.CreateParentDataTable();
DataView dv = new DataView(dt);
// AllowNew - default value
Assert.Equal(true, dv.AllowNew);
// AllowNew - true
dv.AllowNew = true;
Assert.Equal(true, dv.AllowNew);
// AllowNew - false
dv.AllowNew = false;
Assert.Equal(false, dv.AllowNew);
// AllowNew - exception
Assert.Throws<DataException>(() =>
{
dv.AddNew();
});
dv.AllowNew = true;
int RowsCount = dv.Count;
// AllowNew - exception
dv.AddNew();
Assert.Equal(RowsCount + 1, dv.Count);
}