Exemplo n.º 1
0
        public async Task ContextPublishesToAdditionalModuleAsync()
        {
            var context = TestContextBuilder.Create <InMemoryEventStore, TestModule>(TestModule.Initialize, OtherModule.Initialize);
            var id      = new AggregateId(Guid.NewGuid());
            await context.WhenAsync(new TestCommand(id));

            context.Then(events => Assert.True(events.OfType <OtherEvent>().Happened()));
        }
Exemplo n.º 2
0
        public async Task FlowAsync()
        {
            var context = TestContextBuilder.Create <InMemoryEventStore, SalesModule>(
                SalesModule.Initialize,
                PaymentModule.Initialize,
                WarehouseModule.Initialize,
                ShippingModule.Initialize
                );

            await context.WhenAsync(new Sales.PlaceOrder());

            context.Then((events, table) => {
                testOutput.WriteLine(table);
                Assert.True(events.AsEnvelopes().Happened <OrderCompleted>());
            });
        }
Exemplo n.º 3
0
 public StateChangeGameTestsWeb(ITestOutputHelper outputHelper)
 {
     this.context = TestContextBuilder.Create <InMemoryEventStore, GameModule>((store, pub) =>
     {
         this.helper = outputHelper;
         var module  = GameModule.Initialize(store, new InMemorySnapshotStore(), pub);
         hostBuilder = RPS.Web.Program.CreateHostBuilder(Array.Empty <string>())
                       .ConfigureWebHost(webHost => webHost
                                         .UseTestServer()
                                         .ConfigureTestServices(services =>
                                                                services
                                                                .AddSingleton(module)
                                                                .Remove(services.SingleOrDefault(x => x.ImplementationType == typeof(ChangeFeedHostedService)))
                                                                ));
         return(module);
     });
 }