Esempio n. 1
0
        protected DatabaseTestCase(DatabaseFixture databaseFixture)
        {
            var id = Guid.NewGuid().ToString().Replace("-", "");

            var databaseName = $"glfTestDb_{id}";

            using (var tmplConnection = new NpgsqlConnection(databaseFixture.Connection))
            {
                tmplConnection.Open();

                using (var cmd = new NpgsqlCommand($"CREATE DATABASE {databaseName} WITH TEMPLATE {databaseFixture.TemplateDatabaseName}", tmplConnection))
                {
                    cmd.ExecuteNonQuery();
                }
            }

            var connection = $"Host=localhost;Port=33030;Database={databaseName};User Id=devdbuser;Password=devdbpassword";

            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>();

            optionsBuilder.UseNpgsql(connection);

            DbContext = new ApplicationDbContext(optionsBuilder.Options);
        }
Esempio n. 2
0
 public FindUserByIdHandlerTest(DatabaseFixture databaseFixture) : base(databaseFixture)
 {
     // _handler = new FindUserByIdHandlerTest(DbContext);
 }