public void HasOneExpiredSubscription()
        {
            var manager = new SubscriptionExpirationManager(userRepository, subscriptionRepository, loginRepository);
            var res     = manager.GetAllExpiredSubscriptions();

            Assert.NotNull(res);
            Assert.AreEqual(1, res.Count());
        }
        public void HasOneExpiringSubscriptionUserOn3DaysNotice()
        {
            var manager = new SubscriptionExpirationManager(userRepository, subscriptionRepository, loginRepository);
            var res     = manager.GetEmailListOfSoonToBeExpiredSubscription(3);

            Assert.NotNull(res);
            Assert.AreEqual(1, res.Count());
        }
        public void HasTwoExpiringSubscriptionUserOnOneMonthNotice()
        {
            var manager = new SubscriptionExpirationManager(userRepository, subscriptionRepository, loginRepository);
            var res     = manager.GetEmailListOfSoonToBeExpiredSubscription(30);

            Assert.NotNull(res);
            Assert.AreEqual(2, res.Count());
            Assert.IsTrue(res.Any(email => email == "*****@*****.**"));
            Assert.IsTrue(res.Any(email => email == "*****@*****.**"));
            Assert.IsTrue(res.All(email => email != "*****@*****.**"));
        }
 public ExpiredSubscriptionDeletionService(IUserRepository userRepository, ILoginRepository loginRepository, ISubscriptionRepository subscriptionRepository)
 {
     subscriptionExpirationManager = new SubscriptionExpirationManager(userRepository, subscriptionRepository, loginRepository);
     this.subscriptionRepository   = subscriptionRepository;
     RecurringJob.AddOrUpdate(() => Process(), Cron.Daily);
 }
Ejemplo n.º 5
0