Exemplo n.º 1
0
        public void PostgreSql_statements_insert()
        {
            //Arrange
            const string table    = "mymigration";
            const string expected = "INSERT";

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

            //Assert
            Assert.Contains(expected, s.InsertMigration, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.InsertMigration);
        }
Exemplo n.º 2
0
        public void PostgreSql_statements_drop_migration()
        {
            //Arrange
            const string table    = "mymigration";
            const string expected = "DROP";

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

            //Assert
            Assert.Contains(expected, s.DropMigrationsTable, StringComparison.InvariantCultureIgnoreCase);
            Assert.Contains(table, s.DropMigrationsTable);
        }
Exemplo n.º 3
0
        public void PostgreSql_statements_migration_exists()
        {
            //Arrange
            const string table    = "mymigration";
            const string expected = "SELECT";

            //Act
            var s = new PostgreSqlStatements(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);
        }
Exemplo n.º 4
0
        public void PostgreSql_statements_update()
        {
            //Arrange
            const string table    = "mymigration";
            const string expected = "UPDATE";

            //Act
            var s = new PostgreSqlStatements(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);
        }
Exemplo n.º 5
0
        public void PostgreSql_statements_command_splitter()
        {
            //Arrange
            const string value      = ";";
            const string lowerValue = ";";
            const string table      = "mymigration";
            const string schema     = "tst";

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

            //Assert
            Assert.True(s.CommandSplitter.Match(value).Success);
            Assert.True(s.CommandSplitter.Match(lowerValue).Success);
        }
Exemplo n.º 6
0
        public void PostgreSql_statements_create_migration_with_schema()
        {
            //Arrange
            const string table    = "mymigration";
            const string schema   = "tst";
            const string expected = "CREATE";

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

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