コード例 #1
0
        private void ConfigureReplayEvents(IServiceCollection services)
        {
            var contextBuilder = new RabbitMQContextBuilder()
                                 .SetLoggerFactory(_loggerFactory)
                                 .WithConnectionTimeout(5000)
                                 .ReadFromEnvironmentVariables()
                                 .WithExchange(NameConstants.BffWebshopEventReplayExchange);

            using (var context = contextBuilder.CreateContext())
                using (var replayService = new EventReplayService(context, services, 5000))
                {
                    replayService.StartEventReplay();
                }
        }
コード例 #2
0
        private void StartEventReplay()
        {
            var timeout = 5000;

            var connectionBuilder = new RabbitMQContextBuilder()
                                    .SetLoggerFactory(_loggerFactory)
                                    .WithConnectionTimeout(timeout)
                                    .ReadFromEnvironmentVariables()
                                    .WithExchange(NameConstants.BestelServiceEventReplayExchange);

            using (var context = connectionBuilder.CreateContext())
                using (var replayService = new EventReplayService(context, _services, timeout))
                {
                    replayService.StartEventReplay();
                }
        }
        public void BeforeEach()
        {
            _connectionMock           = new Mock <IConnection>(MockBehavior.Strict);
            _channelMock              = new Mock <IModel>(MockBehavior.Strict);
            _artikelDataMapperMock    = new Mock <IArtikelDataMapper>(MockBehavior.Loose);
            _bestellingDataMapperMock = new Mock <IBestellingDataMapper>(MockBehavior.Strict);
            _eventPublisherMock       = new Mock <IEventPublisher>(MockBehavior.Strict);

            _connectionMock.Setup(conn => conn.CreateModel()).Returns(_channelMock.Object);

            _nijnContext = new TestBusContextBuilder()
                           .WithMockConnection(_connectionMock.Object)
                           .CreateTestContext();

            var services = new ServiceCollection();

            services.AddSingleton(_artikelDataMapperMock.Object);
            services.AddSingleton(_bestellingDataMapperMock.Object);
            services.AddSingleton(_eventPublisherMock.Object);

            _target = new EventReplayService(_nijnContext, services, 1000);
        }