public void Cleanup() { //drop the test directory try { if (Directory.Exists(_testConfiguration.WorkspacePath)) { Directory.Delete(_testConfiguration.WorkspacePath, true); } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } //drop test database try { _testDataService.CleanupDbObjects(_testConfiguration.ConnectionString); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
public void Test_Drop_All_Test_Databases() { var databases = new List <string> { }; //get default connection string template from env variable var connectionString = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_TEST_VARIABLE.YUNIQL_TEST_CONNECTION_STRING); if (!connectionString.Contains("=yuniqldb")) { throw new Exception("Your default database in your test connection string must be \"yuniqldb\". This is replaced during test execution with test database per test case."); } databases.ForEach(database => { try { var targetConnectionString = connectionString.Replace("yuniqldb", database); _testDataService.CleanupDbObjects(targetConnectionString); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }); }