Beispiel #1
0
        public TestBase()
        {
            var services         = new ServiceCollection();
            var configuration    = ConfigurationRootCreator.Create(services);
            var elasticsearchUrl = configuration["ElasticsearchUrl"];
            var connection       = new ConnectionSettings(new Uri(elasticsearchUrl));

            connection.DisableDirectStreaming(true);

            Resolver = EventFlowOptions.New
                       .UseServiceCollection(services)
                       .RegisterModule <BookingDomainModule>()
                       .RegisterModule <CommandModule>()
                       .RegisterModule <CommandHandlersModule>()
                       .RegisterModule <ElasticsearchReadModelModule>()
                       .RegisterModule <ElasticsearchQueryHandlersModule>()
                       .ConfigureElasticsearch(connection)
                       .CreateResolver();

            CommandBus     = Resolver.Resolve <ICommandBus>();
            QueryProcessor = Resolver.Resolve <IQueryProcessor>();

            var indexer = Resolver.Resolve <BookingReadModelIndexer>();

            indexer.PrepareIndex();
        }
Beispiel #2
0
        public TestBase()
        {
            var services = new ServiceCollection();

            ConfigurationRootCreator.Create(services);

            BookingId = BookingId.New;
            Resolver  = EventFlowOptions.New
                        .UseServiceCollection(services)
                        .RegisterModule <BookingDomainModule>()
                        .RegisterServices(r => r.Register <IDbContextProvider <EventStoreContext>, FakedEventStoreContextProvider>())
                        .CreateResolver();

            AggregateStore = Resolver.Resolve <IAggregateStore>();
        }
Beispiel #3
0
        public TestBase()
        {
            var services      = new ServiceCollection();
            var configuration = ConfigurationRootCreator.Create(services);

            services.Configure <RabbitMqOption>(configuration);
            services.ConfigureBus();
            services.AddSingleton <ISubscribeSynchronousToAll, RabbitMqEventPublisher>();

            Resolver = EventFlowOptions.New
                       .UseServiceCollection(services)
                       .RegisterModule <BookingDomainModule>()
                       .RegisterModule <CommandModule>()
                       .RegisterModule <CommandHandlersModule>()
                       .RegisterServices(r => r.Register <IDbContextProvider <EventStoreContext>, FakedEventStoreContextProvider>())
                       .CreateResolver(false);

            CommandBus    = Resolver.Resolve <ICommandBus>();
            HostedService = Resolver.Resolve <IHostedService>();
        }
        public TestBase()
        {
            var services = new ServiceCollection();

            ConfigurationRootCreator.Create(services);

            Resolver = EventFlowOptions.New
                       .UseServiceCollection(services)
                       .RegisterModule <BookingDomainModule>()
                       .RegisterModule <CommandModule>()
                       .RegisterModule <CommandHandlersModule>()
                       .RegisterModule <InMemoryReadModelModule>()
                       .RegisterServices(register =>
            {
                register.Register <IDbContextProvider <EventStoreContext>, FakedEventStoreContextProvider>();
            })

                       .CreateResolver();

            CommandBus = Resolver.Resolve <ICommandBus>();
        }
Beispiel #5
0
        public TestBase()
        {
            var services = new ServiceCollection();

            ConfigurationRootCreator.Create(services);

            Resolver = EventFlowOptions.New
                       .UseServiceCollection(services)
                       .RegisterModule <BookingDomainModule>()
                       .RegisterModule <EntityFrameworkEventStoreModule>()
                       .RegisterModule <CommandModule>()
                       .RegisterModule <CommandHandlersModule>()
                       .RegisterModule <EntityFrameworkReadModelModule>()
                       .RegisterModule <EntityFrameworkQueryHandlersModule>()
                       .RegisterServices(register =>
            {
                register.Register <IDbContextProvider <RestAirlineReadModelContext>, FakedEntityFramewokReadModelDbContextProvider>();
                register.Register <IDbContextProvider <EventStoreContext>, FakedEventStoreContextProvider>();
            })
                       .CreateResolver();

            CommandBus     = Resolver.Resolve <ICommandBus>();
            QueryProcessor = Resolver.Resolve <IQueryProcessor>();
        }