Example #1
0
        public void Perform_MissingUser_BetaFull_Sorry()
        {
            Join_Accessor target = new Join_Accessor(); // TODO: Initialize to an appropriate value

            IDataStore     store  = DataStore.GetInstance();
            IConfiguration config = Configuration.GetInstance();

            int count = 0;

            while (store.Subscriptions.Count() < config.BetaLimit)
            {
                store.Save(new Subscription
                {
                    Next  = DateTime.UtcNow,
                    Phone = string.Format(CultureInfo.InvariantCulture, "+1111222{0}", count++),
                });
            }

            IncomingSmsMessage message = new IncomingSmsMessage
            {
                From    = base.NonSubscriberPhone,
                Message = target.Action,
            };

            Assert.AreEqual(config.BetaLimit, store.Subscriptions.Count());

            target.PerformAdmin(message);

            Assert.AreEqual(config.BetaLimit, store.Subscriptions.Count());

            base.OutgoingMessageExists(message.From, SmsResponseStrings.Join_SorryBetaFull());
            base.OutgoingMessageExists(config.AdminNumber, SmsResponseStrings.Join_AdminBetaReject());
        }
Example #2
0
        protected override void PerformUnknownUser(Domain.IncomingSmsMessage message)
        {
            IDataStore     store  = DataStore.GetInstance();
            IConfiguration config = Configuration.GetInstance();

            if (store.Subscriptions.Count() < config.BetaLimit)
            {
                Subscription s = new Subscription
                {
                    Phone = message.From,
                    Next  = DateTime.UtcNow,
                };

                store.Save(s);

                Say(message.From, SmsResponseStrings.Join_Created());
            }
            else
            {
                Say(message.From, SmsResponseStrings.Join_SorryBetaFull());
                Say(config.AdminNumber, SmsResponseStrings.Join_AdminBetaReject());
            }
        }