Esempio n. 1
0
 public void current_version_returns_missing_control_table_when_there_is_a_database_but_no_history_table()
 {
     database = "db_" + Guid.NewGuid().ToString("N");
     var sqlserver = new SqlServerCommander(CreateConnection, null, database);
     using (IDbConnection connection = CreateConnection())
     {
         connection.Open();
         using (IDbCommand cmd = connection.CreateCommand())
         {
             cmd.CommandText = string.Format("create database {0}", database);
             object result = cmd.ExecuteNonQuery();
         }
     }
     DatabaseVersion version = sqlserver.CurrentVersion();
     Assert.AreEqual(DatabaseVersionType.MissingMigrationHistoryTable, version.Type);
 }
Esempio n. 2
0
 public void current_version_returns_not_created_when_there_is_no_database()
 {
     var sqlserver = new SqlServerCommander(CreateConnection);
     DatabaseVersion version = sqlserver.CurrentVersion();
     Assert.AreEqual(DatabaseVersionType.NotCreated, version.Type);
 }
Esempio n. 3
0
        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);
        }