public void BeforeEach() { _bestellingBuilder = new BevestigdeBestellingBuilder(); _connection = new SqliteConnection("DataSource=:memory:"); _connection.Open(); var options = new DbContextOptionsBuilder <BffContext>() .UseSqlite(_connection) .Options; _dbContext = new BffContext(options); _dbContext.Database.EnsureCreated(); var bestellingDataMapper = new BestellingDataMapper(_dbContext); var klantDataMapper = new KlantDataMapper(_dbContext); var magazijnSessionDataMapper = new MagazijnSessionDataMapper(_dbContext); _jwtHelperMock = new Mock <IJwtHelper>(MockBehavior.Strict); _nijnContext = new TestBusContextBuilder().CreateTestContext(); _target = new BestellingController( new CommandPublisher(_nijnContext), bestellingDataMapper, klantDataMapper, magazijnSessionDataMapper, _jwtHelperMock.Object, new LoggerFactory() ); SeedDatabase(); }
public void Initialize() { _connection = new SqliteConnection("DataSource=:memory:"); _connection.Open(); _options = new DbContextOptionsBuilder <BffContext>() .UseSqlite(_connection) .Options; _context = new BffContext(_options); _target = new KlantDataMapper(_context); _context.Database.EnsureCreated(); }
private void ConfigureDatabase(IServiceCollection services) { DbContextOptions <BffContext> options = new DbContextOptionsBuilder <BffContext>() .UseNpgsql(Environment.GetEnvironmentVariable("DB_CONNECTION_STRING") ?? throw new InvalidOperationException()) .Options; services.AddSingleton(options); using (var context = new BffContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var klanten = Mapper.Map <List <Klant> >(DummyKlanten.Klanten); context.KlantEntities.AddRange(klanten); context.SaveChanges(); } }
public BestellingDataMapper(BffContext context) { _context = context; }
public KlantDataMapper(BffContext context) { _context = context; }
public ArtikelDataMapper(BffContext context) { _context = context; }
public MagazijnSessionDataMapper(BffContext context) { _context = context; }