public void Setup() { var databaseManager = new DisposableDbManager(DbCreationPath, ConnectionString, CatalogName); _disposableDbName = databaseManager.CreateCompleteDisposableDb(); var sqlConnectionStringBuilder = new SqlConnectionStringBuilder(ConnectionString) { InitialCatalog = _disposableDbName }; _connectionStringWithDbName = sqlConnectionStringBuilder.ToString(); }
private string CreateDisposableDb(string databaseName) { var restOfConnString = ConfigurationManager.AppSettings["DisposableDbConnString"] + ";Application Name=" + ApplicationNameForConnectionString + ";"; var dbhostname = ConfigurationManager.AppSettings["DisposableDbHostname"]; var dbCreationPath = ConfigurationManager.AppSettings["DbCreationPath"]; var server = ConnectionHelper.Connect(dbhostname, restOfConnString); var disposableDbManager = new DisposableDbManager(dbCreationPath, server, databaseName); var disposableDbName = disposableDbManager.CreateCompleteDisposableDb(); return string.Format("Initial Catalog={0};Data Source={1};{2}", disposableDbName, dbhostname, restOfConnString); }
public void CreateDisposableDb() { string dbCreationPath = ConfigurationManager.AppSettings["DbCreationPath"]; Server server = DatabaseCreationTests.GetDisposableDbServer(); var creator = new DisposableDbManager(dbCreationPath, server, DbName); DisposableDb = server.Databases[creator.CreateCompleteDisposableDb()]; }