public void execute_migration() { var sqlserver = new SqlServerCommander(CreateDatabaseConnection); database = sqlserver.Create(); sqlserver.ExecuteMigration(new Migration { Number = "20150101", Sql = "create table test (id int primary key clustered)" }); using (IDbConnection connection = CreateConnection()) { connection.Open(); using (IDbCommand cmd = connection.CreateCommand()) { cmd.CommandText = string.Format("select count(*) from {0}.sys.tables where name='test'", database); object result = cmd.ExecuteScalar(); Assert.AreEqual(1, result); } } }
public void get_correct_version_number() { var sqlserver = new SqlServerCommander(CreateDatabaseConnection); database = sqlserver.Create(); sqlserver.ExecuteMigration(new Migration { Number = "20150101", Sql = "create table test (id int primary key clustered)" }); sqlserver.ExecuteMigration(new Migration { Number = "20150102", Sql = "create table test2 (id int primary key clustered)" }); DatabaseVersion version = sqlserver.CurrentVersion(); Assert.AreEqual(DatabaseVersionType.VersionNumber, version.Type); Assert.AreEqual("20150102", version.Number); }