public void Should_be_able_process_sequence_number_tail() { var configuration = new Mock <IEventStoreConfiguration>(); configuration.Setup(m => m.ProjectionEventFetchCount).Returns(100); configuration.Setup(m => m.SequenceNumberTailThreadWorkerInterval).Returns(100); configuration.Setup(m => m.ProjectionThreadCount).Returns(1); var pipelineFactory = new Mock <IPipelineFactory>(); pipelineFactory.Setup(m => m.GetPipeline <EventProcessingPipeline>()).Returns( new EventProcessingPipeline( new Mock <IProjectionEventObserver>().Object, new Mock <IProjectionEventEnvelopeObserver>().Object, new Mock <IProcessEventObserver>().Object, new Mock <IAcknowledgeEventObserver>().Object, new Mock <ITransactionScopeObserver>().Object)); var processor = new EventProcessor(configuration.Object, pipelineFactory.Object, new Mock <IProjectionRepository>().Object); var projection = new Projection("projection-1", 200, Environment.MachineName, AppDomain.CurrentDomain.BaseDirectory); processor.AddProjection(projection); var projectionAggregation = processor.GetProjectionAggregation(projection.AggregationId); for (var i = 50; i < 101; i++) { projectionAggregation.AddPrimitiveEvent(new PrimitiveEvent { SequenceNumber = i }); } Assert.That(projectionAggregation.IsEmpty, Is.False); Assert.That(projectionAggregation.SequenceNumberTail, Is.EqualTo(200)); try { processor.Start(); var timeout = DateTime.Now.AddSeconds(60); while (!projectionAggregation.IsEmpty && DateTime.Now < timeout) { Thread.Sleep(100); } Assert.That(projectionAggregation.IsEmpty, Is.True); Assert.That(projectionAggregation.SequenceNumberTail, Is.EqualTo(200)); } finally { processor.Stop(); } }