public static List <T> AssertPublishedDomainEvents <T>(Entity aggregate) where T : IDomainEvent { var domainEvents = DomainEventsTestHelper.GetAllDomainEvents(aggregate).OfType <T>().ToList(); if (!domainEvents.Any()) { throw new Exception($"{typeof(T).Name} event not published"); } return(domainEvents); }
public static T AssertPublishedDomainEvent <T>(Entity aggregate) where T : IDomainEvent { var domainEvent = DomainEventsTestHelper.GetAllDomainEvents(aggregate).OfType <T>().SingleOrDefault(); if (domainEvent == null) { throw new Exception($"{typeof(T).Name} event not published"); } return(domainEvent); }