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();
        }
Esempio n. 2
0
        public void Initialize()
        {
            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();

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

            _context = new BffContext(_options);
            _target  = new MagazijnSessionDataMapper(_context);

            _context.Database.EnsureCreated();
        }