public void SetUp() { _eventInstance = new TestHandleEvent(); _handleCommandInstance = new TestHandleCommand(); _resultPublisherMock = new Mock <IResultPublisher>(); _eventHandler = new CqrsMessagingHandler(_resultPublisherMock.Object, new [] { _handleCommandInstance }, new[] { _eventInstance }); }
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); }