public void Database_IsExists() { using (var connection = ConnectionUtil.CreateConnection(_masterDbConnectionString)) { var databaseName = ConnectionUtil.GetDatabaseName(); var sql = $@"select * from pg_database where datname = '{databaseName}'"; var result = connection.QueryFirstOrDefault <string>(sql); Assert.NotNull(result); Assert.True(databaseName.Equals(result, System.StringComparison.CurrentCultureIgnoreCase)); } }
private void CreateDatabase() { var masterConn = ConnectionUtil.GetMasterConnectionString(); var databaseName = ConnectionUtil.GetDatabaseName(); using (var connection = ConnectionUtil.CreateConnection(masterConn)) { connection.Execute($@" DROP DATABASE IF EXISTS ""{databaseName}""; CREATE DATABASE ""{databaseName}"";"); } }
public SqlServerStorageTest() { _dbName = ConnectionUtil.GetDatabaseName(); _masterDbConnectionString = ConnectionUtil.GetMasterConnectionString(); _dbConnectionString = ConnectionUtil.GetConnectionString(); }