Exemplo n.º 1
0
        public void BeforeEach()
        {
            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();

            _options = new DbContextOptionsBuilder <BestelContext>()
                       .UseSqlite(_connection)
                       .EnableSensitiveDataLogging()
                       .Options;

            _nijnHost = new TestBusContextBuilder().CreateTestContext();

            _context = new BestelContext(_options);
            _context.Database.EnsureCreated();
            SeedDatabase();

            var bestellingDataMapper = new BestellingDataMapper(_context);
            var artikelDataMapper    = new ArtikelDataMapper(_context);
            var eventPublisher       = new EventPublisher(_nijnHost);

            _target = new BestellingController(
                bestellingDataMapper: bestellingDataMapper,
                artikelDataMapper: artikelDataMapper,
                eventPublisher: eventPublisher,
                loggerFactory: new LoggerFactory()
                );
        }
        public void BeforeEach()
        {
            _bestellingBuilder = new BestellingBuilder();

            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();

            var options = new DbContextOptionsBuilder <BestelContext>()
                          .UseSqlite(_connection)
                          .EnableSensitiveDataLogging()
                          .Options;

            _nijnContext = new TestBusContextBuilder().CreateTestContext();

            _dbContext = new BestelContext(options);
            _dbContext.Database.EnsureCreated();
            SeedDatabase();

            var artikelDataMapper    = new ArtikelDataMapper(_dbContext);
            var bestellingDataMapper = new BestellingDataMapper(_dbContext);
            var eventPublisher       = new EventPublisher(_nijnContext);

            _target = new EventListener(artikelDataMapper, bestellingDataMapper, eventPublisher);

            _dbContext.Database.EnsureCreated();
        }
        public void Initialize()
        {
            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();

            _options = new DbContextOptionsBuilder <BestelContext>()
                       .UseSqlite(_connection)
                       .EnableSensitiveDataLogging()
                       .Options;

            _context = new BestelContext(_options);
            _context.Database.EnsureCreated();
        }
        public void BeforeEach()
        {
            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();

            _options = new DbContextOptionsBuilder <BestelContext>()
                       .UseSqlite(_connection)
                       .Options;

            _bestelContext = new BestelContext(_options);
            _bestelContext.Database.EnsureCreated();

            _target = new ArtikelDataMapper(_bestelContext);
        }
Exemplo n.º 5
0
        private void ConfigureDatabase()
        {
            DbContextOptions <BestelContext> options = new DbContextOptionsBuilder <BestelContext>()
                                                       .UseNpgsql(Environment.GetEnvironmentVariable("DB_CONNECTION_STRING") ?? throw new InvalidOperationException())
                                                       .Options;

            _services.AddSingleton(options);

            using (var bestelContext = new BestelContext(options))
            {
                bestelContext.Database.EnsureDeleted();
                bestelContext.Database.EnsureCreated();
            }
        }
        public void BeforeScenario()
        {
            SpecFlowTestLock.Lock();

            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();

            var options = new DbContextOptionsBuilder <BestelContext>()
                          .UseSqlite(_connection)
                          .Options;

            _context = new BestelContext(options);
            _context.Database.EnsureCreated();

            SeedDatabase();
        }
 public ArtikelDataMapper(BestelContext context)
 {
     _context = context;
 }
Exemplo n.º 8
0
 public BestellingDataMapper(BestelContext context)
 {
     _context = context;
 }