private void SetupDbContext(string databaseName) { var connectionString = $"Host=localhost;Database={databaseName};Username=docker;Password=docker"; var builder = new DbContextOptionsBuilder <GetIntoTeachingDbContext>(); DbConfiguration.ConfigPostgres(connectionString, builder); DbContext = new GetIntoTeachingDbContext(builder.Options); }
public LocationSyncJob( IEnv env, GetIntoTeachingDbContext dbContext, ILogger <LocationSyncJob> logger, IMetricService metrics) : base(env) { _logger = logger; _dbContext = dbContext; _metrics = metrics; }
public Store( GetIntoTeachingDbContext dbContext, IGeocodeClientAdapter geocodeClient, ICrmService crm, IDateTimeProvider dateTime) { _dbContext = dbContext; _geocodeClient = geocodeClient; _crm = crm; _dateTime = dateTime; }
public DatabaseFixture() { TemplateDatabaseName = $"gis_test"; ConnectionString = $"Host=localhost;Database={TemplateDatabaseName};Username=docker;Password=docker"; var builder = new DbContextOptionsBuilder <GetIntoTeachingDbContext>(); DbConfiguration.ConfigPostgres(ConnectionString, builder); _dbContext = new GetIntoTeachingDbContext(builder.Options); _dbContext.Database.Migrate(); _dbContext.Database.CloseConnection(); }
public DatabaseFixture() { TemplateDatabaseName = $"gis_test"; ConnectionString = $"Host=localhost;Database={TemplateDatabaseName};Username=docker;Password=docker"; // Set environment for integration tests using the database. Environment.SetEnvironmentVariable("DATABASE_INSTANCE_NAME", TemplateDatabaseName); Environment.SetEnvironmentVariable("VCAP_SERVICES", $"{{\"postgres\": [{{\"instance_name\": \"{TemplateDatabaseName}\",\"credentials\": {{\"host\": \"localhost\"," + $"\"name\": \"{TemplateDatabaseName}\",\"username\": \"docker\",\"password\": \"docker\",\"port\": 5432}}}}]," + $"\"redis\": [{{\"credentials\": {{\"host\": \"0.0.0.0\",\"port\": 6379,\"password\": \"docker\",\"tls_enabled\": false}}}}]}}"); var builder = new DbContextOptionsBuilder <GetIntoTeachingDbContext>(); DbConfiguration.ConfigPostgres(ConnectionString, builder); _dbContext = new GetIntoTeachingDbContext(builder.Options); _dbContext.Database.Migrate(); _dbContext.Database.CloseConnection(); }
public Store(GetIntoTeachingDbContext dbContext, IGeocodeClientAdapter geocodeClient, ICrmService crm) { _dbContext = dbContext; _geocodeClient = geocodeClient; _crm = crm; }