示例#1
0
 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>()));
 }
示例#2
0
 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>()));
 }
示例#3
0
 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));
 }