private static MessagingBus SetupBus(OrderView orderView) { IPersistanceStore persitenceStore = new MemoryPersistance(); IDomainEventQuery domainEventQuery = new InProcPersistedDomainEventQuery(persitenceStore); IDomainEventStore domainEventStore = new PyxisDomainEventStore( persitenceStore, domainEventQuery); IDomainResultStoreQuery storeQuery = new InProcDomainResultStoreQuery(persitenceStore); IDomainResultStore resultStore = new DomainResultPersistanceStore( persitenceStore, storeQuery); ITimeoutProvider timeoutProvider = new TimeoutProvider(1000); IResultPublisher resultPublisher = new ResultPublisher( resultStore, timeoutProvider); IResultAwaiter resultAwaiter = new ResultAwaiter( resultStore, timeoutProvider); IList <IHandleCommand> commandHanlders = new List <IHandleCommand>(); IList <IHandleEvent> eventHandlers = new List <IHandleEvent>(); IMessageDispatcher <ICommand> commandDispatcher = new CqrsMessagingHandler( resultPublisher, commandHanlders, eventHandlers); ICommandQueue commandQueue = new InProcCommandQueue(commandDispatcher); MessagingBus bus = new MessagingBus( commandQueue, resultPublisher, resultAwaiter); IDomainRepository domainRepository = new DomainRepository( domainEventStore, bus); ISession session = new Session(domainRepository); commandHanlders.Add(new OrderCommandHandler(session)); eventHandlers.Add(new OrderEventHandler(orderView)); return(bus); }
public void SetUp() { var persistanceStore = new MemoryPersistance(); _pyxisDomainEventStore = new PyxisDomainEventStore(persistanceStore, new InProcPersistedDomainEventQuery(persistanceStore)); }