public void ApplyScripts() { CommandModel config = new CommandModel(); config.PluginType = "ApplyScript"; config.Settings = new List <CommandSettingModel>() { new CommandSettingModel() { Name = "ProviderName", Value = ProviderName }, new CommandSettingModel() { Name = "ConnectionString", Value = ConnectionString }, new CommandSettingModel() { Name = "TablePrefix", Value = "TEST_BUILD" } }; ISettingStore settings = new SettingStore(config, null); IDataStore data = new DataStore(); List <string> scripts = new List <string>() { "src1/sql/script2.sql", "src1/sql/script3.sql" }; data.SetValue <List <string> >("ScriptsToApply", scripts); IPluginCommand cmd = new ApplyScriptCommand(settings, data); bool res = cmd.Execute(); Assert.IsTrue(res); using (DbConnection connection = TestDbHelper.GetConnection(ProviderName, ConnectionString)) { using (DbCommand sqlCmd = connection.CreateCommand()) { sqlCmd.CommandText = "select count(*) from TEST_BUILD_DB_DELIVERY_HISTORY"; int count = (int)sqlCmd.ExecuteScalar(); Assert.AreEqual(2, count); } using (DbCommand sqlCmd = connection.CreateCommand()) { sqlCmd.CommandText = "select count(*) from TEST_TABLE"; int count = (int)sqlCmd.ExecuteScalar(); Assert.AreEqual(2, count); } } }
public static void MyClassInitialize(TestContext testContext) { TestDbHelper.Init(ProviderName, ConnectionString); }