public void ResolvedUnitOfWorkEventHandlersAreExecutedInCorrectOrder() { TestAggregateRoot aggregateRoot = new TestAggregateRoot(Guid.NewGuid()); aggregateRoot.ApplyEvent(domainEvent); sut.ApplyChangesAsync(aggregateRoot).Wait(); unitOfWorkDomainEventHandler1.Received().ExecuteAsync(domainEvent, unitOfWork); unitOfWorkDomainEventHandler2.Received().ExecuteAsync(domainEvent, unitOfWork); }
public void EventHandlersAreExecutedWithSingleEvent() { sut.PublishEvent(testEvent1); Received.InOrder(() => { domainEventHandler1.Received().Execute(testEvent1, unitOfWork); domainEventHandler2.Received().Execute(testEvent1, unitOfWork); asyncDomainEventHandler1.Received().ExecuteAsync(testEvent1, unitOfWork); asyncDomainEventHandler2.Received().ExecuteAsync(testEvent1, unitOfWork); }); domainEventHandler3.DidNotReceive().Execute(Arg.Any <AnotherTestDomainEvent>(), Arg.Any <TestUnitOfWork>()); asyncDomainEventHandler3.DidNotReceive().ExecuteAsync(Arg.Any <AnotherTestDomainEvent>(), Arg.Any <TestUnitOfWork>()); }