public void Publish_WhenCalled_DoesNotCallUnSubscribersToThisEvent(DomainEventPublisher publisher, IDomainEvent @event, IEnumerable <IDomainEventHandler> unSubscribersToThisEvent) { // Arrange unSubscribersToThisEvent.ForEach(s => s.ClearReceivedCalls()); // Act publisher.Publish(@event); // Assert Assert.All(unSubscribersToThisEvent, s => s.DidNotReceive().Handle(Arg.Any <IDomainEvent>())); }
public void Publish_WhenCalled_DoesNotCallSubscribersToOtherEvents(DomainEventPublisher publisher, IDomainEvent @event, IEnumerable <IDomainEventHandler> subscribersToOtherEvents) { // Arrange subscribersToOtherEvents.ForEach(s => s.ClearReceivedCalls()); // Act publisher.Publish(@event); // Assert Assert.All(subscribersToOtherEvents, s => s.DidNotReceive().Handle(Arg.Any <IDomainEvent>())); }
public void Publish_WhenCalled_CallsSubscribersToThisEvent(DomainEventPublisher publisher, IDomainEvent @event, IEnumerable <IDomainEventHandler> subscribersToThisEvent) { // Arrange subscribersToThisEvent.ForEach(s => s.ClearReceivedCalls()); // Act publisher.Publish(@event); // Assert Assert.All(subscribersToThisEvent, s => s.Received(1).Handle(@event)); }