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())); }
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>()); }); }
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); }); }