public AsyncEventWorkerTests() { asyncEventQueueManager = Substitute.For <IAsyncEventQueueManager>(); serviceLocator = Substitute.For <IServiceLocator>(); sut = new AsyncEventWorker(asyncEventQueueManager, serviceLocator); asyncEventQueueManager.GetQueueStateAsync("queue").Returns(ci => queueState); asyncEventQueueManager.GetQueueEventsAsync("queue").Returns(ci => events); serviceLocator.GetAll(typeof(IAsyncEventListener <Event1>)).Returns(ci => listeners); listeners.Add(Substitute.For <IAsyncEventListener <Event1> >()); listeners.Add(Substitute.For <IAsyncEventListener <Event1> >()); listeners[0].EventSequencer.Returns(Substitute.For <IAsyncEventSequencer <Event1> >()); listeners[1].EventSequencer.Returns(Substitute.For <IAsyncEventSequencer <Event1> >()); listeners[0].EventSequencer.GetEventSequencing(null).ReturnsForAnyArgs(new List <EventSequencing>() { new EventSequencing() { EventSequenceNumber = 0 /* shouldn't be important now */, SequenceName = "queue" } }); listeners[1].EventSequencer.GetEventSequencing(null).ReturnsForAnyArgs(new List <EventSequencing>() { new EventSequencing() { EventSequenceNumber = 0 /* shouldn't be important now */, SequenceName = "queue" } }); }
public AsyncEventProcessor(Func <IAsyncEventWorker> asyncEventWorkerFunc, IAsyncEventQueueManager asyncEventQueueManager, IInMemoryJobScheduler jobScheduler, IAsyncEventPipelineConfiguration asyncEventPipelineConfiguration) { this.asyncEventWorkerFunc = asyncEventWorkerFunc; this.asyncEventQueueManager = asyncEventQueueManager; this.jobScheduler = jobScheduler; this.asyncEventPipelineConfiguration = asyncEventPipelineConfiguration; }
public AsyncEventExecutionCatchUp(IEventSourceCatchUp[] eventSourceCatchUps, IAsyncEventQueueManager asyncEventQueueManager, IAsyncEventPipelineConfiguration asyncEventPipelineConfiguration, Func <IAsyncEventWorker> asyncEventWorkerFunc) { this.eventSourceCatchUps = eventSourceCatchUps; this.asyncEventQueueManager = asyncEventQueueManager; this.asyncEventPipelineConfiguration = asyncEventPipelineConfiguration; this.asyncEventWorkerFunc = asyncEventWorkerFunc; }
public AsyncEventQueueDispatcher(IAsyncEventQueueManager asyncEventQueueManager, IServiceLocator serviceLocator) { this.asyncEventQueueManager = asyncEventQueueManager; this.serviceLocator = serviceLocator; }
public AsyncEventQueueDispatcherTests() { asyncEventQueueManager = Substitute.For <IAsyncEventQueueManager>(); serviceLocator = Substitute.For <IServiceLocator>(); sut = new AsyncEventQueueDispatcher(asyncEventQueueManager, serviceLocator); eventSequencers.Add(Substitute.For <IAsyncEventSequencer <Event1> >()); eventSequencers.Add(Substitute.For <IAsyncEventSequencer <Event1> >()); serviceLocator.GetAll(typeof(IAsyncEventSequencer <Event1>)).Returns(eventSequencers); eventMessages = new List <IEventMessage>() { new EventMessage <Event1>(new Event1(), new Dictionary <string, string>()), new EventMessage <Event1>(new Event1(), new Dictionary <string, string>()) }; eventSequencers[0].GetEventSequencing(eventMessages[0]).Returns(new List <EventSequencing>() { new EventSequencing() { SequenceName = "queue1", EventSequenceNumber = 1 }, new EventSequencing() { SequenceName = "queue2", EventSequenceNumber = 1 }, }); eventSequencers[0].GetEventSequencing(eventMessages[1]).Returns(new List <EventSequencing>() { new EventSequencing() { SequenceName = "queue1", EventSequenceNumber = 2 }, new EventSequencing() { SequenceName = "queue2", EventSequenceNumber = 2 }, }); eventSequencers[0].ShouldAttemptSynchronousDispatch(null).ReturnsForAnyArgs(true); eventSequencers[1].GetEventSequencing(eventMessages[0]).Returns(new List <EventSequencing>() { new EventSequencing() { SequenceName = "queue1", EventSequenceNumber = 1 } }); eventSequencers[1].GetEventSequencing(eventMessages[1]).Returns(new List <EventSequencing>() { new EventSequencing() { SequenceName = "queue3", EventSequenceNumber = 3 } }); eventSequencers[1].ShouldAttemptSynchronousDispatch(eventMessages[0]).ReturnsForAnyArgs(true); eventSequencers[1].ShouldAttemptSynchronousDispatch(eventMessages[1]).ReturnsForAnyArgs(false); }