System.Data.Tests.DataColumnTest.CheckValuesAfterRemovedFromCollection C# (CSharp) Method

CheckValuesAfterRemovedFromCollection() private method

private CheckValuesAfterRemovedFromCollection ( ) : void
return void
        public void CheckValuesAfterRemovedFromCollection()
        {
            DataTable table = new DataTable("table1");
            DataColumn col1 = new DataColumn("col1", typeof(int));
            DataColumn col2 = new DataColumn("col2", typeof(int));

            Assert.Equal(-1, col1.Ordinal);
            Assert.Null(col1.Table);

            table.Columns.Add(col1);
            table.Columns.Add(col2);
            Assert.Equal(0, col1.Ordinal);
            Assert.Equal(table, col1.Table);

            table.Columns.RemoveAt(0);
            Assert.Equal(-1, col1.Ordinal);
            Assert.Null(col1.Table);

            table.Columns.Clear();
            Assert.Equal(-1, col2.Ordinal);
            Assert.Null(col2.Table);
        }