System.Data.Tests.DataColumnCollectionTest2.TestAdd_ByTableName C# (CSharp) Method

TestAdd_ByTableName() private method

private TestAdd_ByTableName ( ) : void
return void
        public void TestAdd_ByTableName()
        {
            //this test is from boris

            var ds = new DataSet();
            DataTable dt = new DataTable();
            ds.Tables.Add(dt);

            // add one column
            dt.Columns.Add("id1", typeof(int));

            // DataColumnCollection add
            Assert.Equal(1, dt.Columns.Count);

            // add row
            DataRow dr = dt.NewRow();
            dt.Rows.Add(dr);

            // remove column
            dt.Columns.Remove("id1");

            // DataColumnCollection remove
            Assert.Equal(0, dt.Columns.Count);

            //row is still there

            // now add column
            dt.Columns.Add("id2", typeof(int));

            // DataColumnCollection add again
            Assert.Equal(1, dt.Columns.Count);
        }