Tests.TableSchemaTests.Drop_Column_Test C# (CSharp) Method

Drop_Column_Test() private method

private Drop_Column_Test ( ) : void
return void
        public void Drop_Column_Test()
        {
            var tableName = "Temp" + Guid.NewGuid().ToString("N");
            GribbleDatabase.CreateTable(tableName,
                                    new Column("Id", typeof(int), isIdentity: true, key: Column.KeyType.PrimaryKey),
                                    new Column("Name", typeof(string), isNullable: true, length: 500),
                                    new Column("Created", typeof(DateTime), isNullable: false, isAutoGenerated: true));

            Database.ExecuteScalar<int>("SELECT COUNT(*) FROM sys.columns WHERE name='Name' and object_id('{0}') = object_id", tableName).ShouldEqual(1);

            GribbleDatabase.RemoveColumn(tableName, "Name");

            Database.ExecuteScalar<int>("SELECT COUNT(*) FROM sys.columns WHERE name='Name' and object_id('{0}') = object_id", tableName).ShouldEqual(0);
        }