public void SetUp() { _persistanceStore = new MemoryPersistance(); _resultPersistance = new DomainResultPersistanceStore(_persistanceStore, new InProcDomainResultStoreQuery(_persistanceStore)); _id = Guid.NewGuid(); _testCommand = new TestDomainCommand { Id = _id, TrackingId = Guid.NewGuid().ToString() }; }
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); }