Exemplo n.º 1
0
        public void TestGeneratePlainSQLStringArrayDown()
        {
            var json = "{\"down\":[\"DELETE FROM [Control] WHERE ControlName LIKE '%Date Label'\",\"DELETE FROM [Control] WHERE ControlName LIKE '%Date Label'\"]}";
            //json = "{\"down\":[\"DELETE FROM [Control] WHERE ControlName = 'Facebook Status'\",\"DELETE FROM [ControlType] WHERE ControlTypeName = 'Facebook'\"]}";

            Configuration           configuration      = new Configuration(new[] { "-s", "1" });
            TestFileWriter          file_writer        = new TestFileWriter();
            ISqlFormatter           formatter          = new SQLServerFormatter(configuration, Settings);
            TestSQLDatabaseProvider _database_provider = new TestSQLDatabaseProvider(configuration, Settings, formatter);

            dynamic migration_object = Helpers.DeserializeMigration(json);

            _database_provider.ExecuteDownCommand(migration_object);
            Assert.AreEqual("DELETE FROM [Control] WHERE ControlName LIKE '%Date Label'DELETE FROM [Control] WHERE ControlName LIKE '%Date Label'", _database_provider.LastCommand);
        }
Exemplo n.º 2
0
        public void TestGeneratePlainSQLString()
        {
            var json = "{\"up\":\"DELETE FROM [Control] WHERE ControlName LIKE '%Date Label'\"}";


            Configuration           configuration      = new Configuration(new[] { "-s", "1" });
            TestFileWriter          file_writer        = new TestFileWriter();
            ISqlFormatter           formatter          = new SQLServerFormatter(configuration, Settings);
            TestSQLDatabaseProvider _database_provider = new TestSQLDatabaseProvider(configuration, Settings, formatter);

            dynamic migration_object = Helpers.DeserializeMigration(json);

            _database_provider.ExecuteUpCommand(migration_object);
            Assert.Equal("DELETE FROM [Control] WHERE ControlName LIKE '%Date Label'", _database_provider.LastCommand);
        }