Example #1
0
 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));
     }
 }
Example #2
0
        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}"";");
            }
        }
Example #3
0
 public SqlServerStorageTest()
 {
     _dbName = ConnectionUtil.GetDatabaseName();
     _masterDbConnectionString = ConnectionUtil.GetMasterConnectionString();
     _dbConnectionString       = ConnectionUtil.GetConnectionString();
 }