public void SetUp() { _resolver = EventFlowOptions.New .AddSagas(typeof(AlternativeSagaStoreTestClasses.TestSaga)) .AddCommandHandlers( typeof(AlternativeSagaStoreTestClasses.SagaTestACommandHandler), typeof(AlternativeSagaStoreTestClasses.SagaTestBCommandHandler), typeof(AlternativeSagaStoreTestClasses.SagaTestCCommandHandler)) .AddEvents( typeof(AlternativeSagaStoreTestClasses.SagaTestEventA), typeof(AlternativeSagaStoreTestClasses.SagaTestEventB), typeof(AlternativeSagaStoreTestClasses.SagaTestEventC)) .RegisterServices(sr => { sr.RegisterType(typeof(AlternativeSagaStoreTestClasses.TestSagaLocator)); sr.Register <ISagaStore, AlternativeSagaStoreTestClasses.InMemorySagaStore>(Lifetime.Singleton); }) .CreateResolver(false); _commandBus = _resolver.Resolve <ICommandBus>(); _aggregateStore = _resolver.Resolve <IAggregateStore>(); _sagaStore = (AlternativeSagaStoreTestClasses.InMemorySagaStore)_resolver.Resolve <ISagaStore>(); }
public void SetUp() { _serviceProvider = EventFlowOptions.New() .AddSagas(typeof(AlternativeSagaStoreTestClasses.TestSaga)) .AddCommandHandlers( typeof(AlternativeSagaStoreTestClasses.SagaTestACommandHandler), typeof(AlternativeSagaStoreTestClasses.SagaTestBCommandHandler), typeof(AlternativeSagaStoreTestClasses.SagaTestCCommandHandler)) .AddEvents( typeof(AlternativeSagaStoreTestClasses.SagaTestEventA), typeof(AlternativeSagaStoreTestClasses.SagaTestEventB), typeof(AlternativeSagaStoreTestClasses.SagaTestEventC)) .RegisterServices(sr => { sr.AddTransient(typeof(AlternativeSagaStoreTestClasses.TestSagaLocator)); sr.AddSingleton <ISagaStore, AlternativeSagaStoreTestClasses.InMemorySagaStore>(); }) .ServiceCollection.BuildServiceProvider(); _commandBus = _serviceProvider.GetRequiredService <ICommandBus>(); _aggregateStore = _serviceProvider.GetRequiredService <IAggregateStore>(); _sagaStore = (AlternativeSagaStoreTestClasses.InMemorySagaStore)_serviceProvider.GetRequiredService <ISagaStore>(); }