public void VerifyActiveInsertTriggersSubscribeEvent()
        {
            var eventPublisher = MockRepository.GenerateStub<IEventPublisher>();
            var repo = MockRepository.GenerateStub<IRepository<NewsLetterSubscription>>();
            var context = MockRepository.GenerateStub<IDbContext>();

            var subscription = new NewsLetterSubscription { Active = true, Email = "*****@*****.**" };

            var service = new NewsLetterSubscriptionService(context, repo, eventPublisher);
            service.InsertNewsLetterSubscription(subscription, true);

            eventPublisher.AssertWasCalled(x => x.Publish(new EmailSubscribedEvent(subscription.Email)));
        }
        public void VerifyInsertEventIsFired()
        {
            var eventPublisher = MockRepository.GenerateStub<IEventPublisher>();
            var repo = MockRepository.GenerateStub<IRepository<NewsLetterSubscription>>();
            var context = MockRepository.GenerateStub<IDbContext>();

            var service = new NewsLetterSubscriptionService(context, repo, eventPublisher);
            service.InsertNewsLetterSubscription(new NewsLetterSubscription { Email = "*****@*****.**" });

            eventPublisher.AssertWasCalled(x => x.EntityInserted(Arg<NewsLetterSubscription>.Is.Anything));
        }