Exemple #1
0
        public void Sql_server_statements_insert()
        {
            //Arrange
            const string table    = "MyMigration";
            const string expected = "INSERT";

            //Act
            var s = new SqlServerStatements(table);

            //Assert
            Assert.Contains(expected, s.InsertMigration, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.InsertMigration);
        }
Exemple #2
0
        public void Sql_server_statements_drop_migration()
        {
            //Arrange
            const string table    = "MyMigration";
            const string expected = "DROP";

            //Act
            var s = new SqlServerStatements(table);

            //Assert
            Assert.Contains(expected, s.DropMigrationsTable, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.DropMigrationsTable);
        }
Exemple #3
0
        public void Sql_server_statements_migration_exists()
        {
            //Arrange
            const string table    = "MyMigration";
            const string expected = "SELECT";

            //Act
            var s = new SqlServerStatements(table);

            //Assert
            Assert.Contains(expected, s.DoesMigrationsTableExist, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.DoesMigrationsTableExist);
            Assert.Contains(expected, s.GetAlreadyRan, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.GetAlreadyRan);
        }
Exemple #4
0
        public void Sql_server_statements_update()
        {
            //Arrange
            const string table    = "MyMigration";
            const string expected = "UPDATE";

            //Act
            var s = new SqlServerStatements(table);

            //Assert
            Assert.Contains(expected, s.UpdateMigrationHash, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.UpdateMigrationHash);
            Assert.Contains(expected, s.RenameMigration, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.RenameMigration);
        }
Exemple #5
0
        public void Sql_server_statements_sql_server_command_splitter()
        {
            //Arrange
            const string value      = "GO";
            const string lowerValue = "go";
            const string table      = "MyMigration";
            const string schema     = "tst";

            //Act
            var s = new SqlServerStatements(table, schema);

            //Assert
            Assert.True(s.CommandSplitter.Match(value).Success);
            Assert.True(s.CommandSplitter.Match(lowerValue).Success);
        }
Exemple #6
0
        public void Sql_server_statements_create_migration_with_schema()
        {
            //Arrange
            const string table    = "MyMigration";
            const string schema   = "tst";
            const string expected = "CREATE";

            //Act
            var s = new SqlServerStatements(table, schema);

            //Assert
            Assert.Contains(expected, s.CreateMigrationsTable, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.CreateMigrationsTable);
            Assert.Contains(schema, s.CreateMigrationsTable);
        }