public void Store_And_Publish_Assert_Was_Called_Test() { // 2) act eventConteiner.Store(pluginName, e); eventConteiner.Publish(pluginName, publisher); // 3) assert publisher.AssertWasCalled(x => x.Publish(e)); }
public void VerifyActiveInsertTriggersSubscribeEvent() { var subscription = new NewsLetterSubscription { Active = true, Email = "*****@*****.**", StoreId = 1 }; _newsLetterSubscriptionService.InsertNewsLetterSubscription(subscription, true); _eventPublisher.AssertWasCalled(x => x.Publish(new EmailSubscribedEvent(subscription.Email))); }
public void Publish_Test() { // 1) arrange var e = new Event_Mock(); // 2) act eventAggregator.SubscribePlugin(plugin); eventAggregator.GlobalPublish(e); // 3) assert eventPublisher.AssertWasCalled(x => x.Publish(e)); }
public void VerifyActiveInsertTriggersSubscribeEvent() { var service = new NewsLetterSubscriptionService(_dbContext, _newsLetterSubscriptionRepository, _customerRepository, _eventPublisher, _customerService); var subscription = new NewsLetterSubscription { Active = true, Email = "*****@*****.**" }; service.InsertNewsLetterSubscription(subscription, true); _eventPublisher.AssertWasCalled(x => x.Publish(new EmailSubscribedEvent(subscription))); }
public void ShouldPublishAllTheOutstandingEvents() { var id = Guid.NewGuid(); var events = new List <DomainEvent> { new EmptyDomainEvent(id) }; _eventStore.SaveEvents(id, events); _eventPublisher.AssertWasCalled(x => x.Publish(Arg <DomainEvent> .Matches(Is.TypeOf <EmptyDomainEvent>()))); }