System.Data.Tests.DeletedRowInaccessibleExceptionTest.Generate C# (CSharp) Method

Generate() private method

private Generate ( ) : void
return void
        public void Generate()
        {
            DataTable dtParent;
            dtParent = DataProvider.CreateParentDataTable();

            DataRow dr = dtParent.Rows[0];
            dr.Delete();

            // DeletedRowInaccessible Exception (BeginEdit)
            Assert.Throws<DeletedRowInaccessibleException>(() =>
            {
                dr.BeginEdit();
            });

            // DeletedRowInaccessible Exception (Item)
            Assert.Throws<DeletedRowInaccessibleException>(() =>
            {
                string s = dr[0].ToString();
            });

            // DeletedRowInaccessible Exception (ItemArray)
            Assert.Throws<DeletedRowInaccessibleException>(() =>
            {
                object[] o = dr.ItemArray;
            });
        }
    }
DeletedRowInaccessibleExceptionTest