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 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 ThenVerwerkEenBestellingInHetSysteemMetHetKlantnummerBesteldatumEnBestelregels() { var bestellingDataMapper = new BestellingDataMapper(_context); var artikelDataMapper = new ArtikelDataMapper(_context); var eventPublisherMock = new Mock <IEventPublisher>(MockBehavior.Strict); var commandSenderMock = new Mock <ICommandSender>(MockBehavior.Strict); var response = new ResponseCommandMessage(JsonConvert.SerializeObject(true), "type", "correlationId"); eventPublisherMock.Setup(p => p.Publish(It.IsAny <DomainEvent>())); commandSenderMock.Setup(sendr => sendr.SendCommandAsync(It.IsAny <RequestCommandMessage>())).ReturnsAsync(response); var controller = new BestellingController(bestellingDataMapper, artikelDataMapper, eventPublisherMock.Object, new LoggerFactory()); var bestelling = new BestellingCM { Klantnummer = _klantnummer, BestelRegels = new List <BestelRegelCM>() }; foreach (var regel in _bestelregels) { bestelling.BestelRegels.Add(new BestelRegelCM() { Artikelnummer = regel.Item1, Aantal = regel.Item5 }); } var result = controller.HandlePlaatsBestelling(new PlaatsBestellingCommand(bestelling, "")); eventPublisherMock.VerifyAll(); Assert.AreEqual(1, result); }
public void BeforeEach() { _bestellingDataMapperMock = new Mock <IBestellingDataMapper>(MockBehavior.Strict); _artikelDataMapperMock = new Mock <IArtikelDataMapper>(MockBehavior.Strict); _eventPublisherMock = new Mock <IEventPublisher>(MockBehavior.Strict); _target = new BestellingController( bestellingDataMapper: _bestellingDataMapperMock.Object, artikelDataMapper: _artikelDataMapperMock.Object, eventPublisher: _eventPublisherMock.Object, loggerFactory: new LoggerFactory() ); }
public void BeforeEach() { _commandPublisherMock = new Mock <ICommandPublisher>(MockBehavior.Strict); _bestellingDataMapperMock = new Mock <IBestellingDataMapper>(MockBehavior.Strict); _klantDataMapperMock = new Mock <IKlantDataMapper>(MockBehavior.Strict); _magazijnSessionDataMapperMock = new Mock <IMagazijnSessionDataMapper>(MockBehavior.Strict); _jwtHelperMock = new Mock <IJwtHelper>(MockBehavior.Strict); _target = new BestellingController( _commandPublisherMock.Object, _bestellingDataMapperMock.Object, _klantDataMapperMock.Object, _magazijnSessionDataMapperMock.Object, _jwtHelperMock.Object, new LoggerFactory() ); }