Esempio n. 1
0
        public void TestDbFails()
        {
            var emailService           = new DummyEmailService();
            var registrationRepository = new DummyRegistrationRepository(true);
            var service = new SubscriptionService(emailService, registrationRepository);

            Assert.Throws <DatabaseUnresponsiveException>(() => service.Subscribe("*****@*****.**"));
            Assert.IsTrue(registrationRepository.CreateHasBeenCalled);
            Assert.IsFalse(emailService.SendHasBeenCalled);
        }
Esempio n. 2
0
        public void TestAllOk()
        {
            var emailService           = new DummyEmailService();
            var registrationRepository = new DummyRegistrationRepository();
            var service = new SubscriptionService(emailService, registrationRepository);

            service.Subscribe("*****@*****.**");
            Assert.IsTrue(emailService.SendHasBeenCalled);
            Assert.IsTrue(registrationRepository.CreateHasBeenCalled);
        }