public ProjectionEventListenerTests() { myEntity1Projector = Substitute.For <IEntityEventProjector>(); myEntity2Projector = Substitute.For <IEntityEventProjector>(); sequencer = Substitute.For <IAsyncEventSequencer <DomainAggregateEvent> >(); sequencer.GetEventSequencing(null).ReturnsForAnyArgs(new[] { new EventSequencing() { SequenceName = "MyProjectionEventListener", EventSequenceNumber = 1 } }); sequencer.ShouldAttemptSynchronousDispatch(null).ReturnsForAnyArgs(true); projectionSubSystem = Substitute.For <IProjectionSubSystem>(); unitOfWorkFactory = Substitute.For <IUnitOfWorkFactory>(); unitOfWork = Substitute.For <IUnitOfWork>(); unitOfWorkFactory.CreateUnitOfWork().Returns(unitOfWork); commandContextStack = new CommandContextStack(); sut = Substitute.ForPartsOf <ProjectionEventListener>(projectionSubSystem, unitOfWorkFactory, commandContextStack); sut.EventSequencer.Returns(sequencer); }
public ProjectionEventListener(IProjectionSubSystem projectionSubSystem, IUnitOfWorkFactory unitOfWorkFactory, CommandContextStack commandContextStack) { this.projectionSubSystem = projectionSubSystem; this.unitOfWorkFactory = unitOfWorkFactory; this.commandContextStack = commandContextStack; }