public void Perform_ExistingUser() { Quit_Accessor target = new Quit_Accessor(); // TODO: Initialize to an appropriate value IncomingSmsMessage message = new IncomingSmsMessage { From = ExistingSubscriberPhone, Message = target.Action, }; Assert.AreEqual(1, base.SubscriptionForNumber(message.From).Count); target.Perform(message); OutgoingMessageExists(base.ExistingSubscriberPhone, SmsResponseStrings.Quit_AllRemoved(base.ExistingSubscriberPhone)); Assert.AreEqual(0, base.SubscriptionForNumber(message.From).Count); }
public void Perform_MissingUser() { Quit_Accessor target = new Quit_Accessor(); // TODO: Initialize to an appropriate value IncomingSmsMessage message = new IncomingSmsMessage { From = "+11112223333", Message = target.Action, }; target.Perform(message); IDataStore store = DataStore.GetInstance(); OutgoingMessageExists(message.From, SmsResponseStrings.Quit_AllRemoved(message.From)); }
public void Perform_ExistingUser_QueuedMessagesRemoved() { Quit_Accessor target = new Quit_Accessor(); // TODO: Initialize to an appropriate value IDataStore store = DataStore.GetInstance(); // add an existing outgoing message - this should be removed when the quit is done store.Save(new OutgoingSmsMessage { Destination = ExistingSubscriberPhone, Message = "Does not matter", }); // add an existing outgoing message - this should be removed when the quit is done store.Save(new OutgoingSmsMessage { Destination = ExistingSubscriberPhone, Message = "Also does not matter", }); Assert.AreEqual(2, store.OutgoingMessages.Count()); IncomingSmsMessage message = new IncomingSmsMessage { From = ExistingSubscriberPhone, Message = target.Action, }; Assert.AreEqual(1, base.SubscriptionForNumber(message.From).Count); target.Perform(message); // there should be only one message in the outgoing queue Assert.AreEqual(1, store.OutgoingMessages.Count()); // and it should be this one... OutgoingMessageExists(base.ExistingSubscriberPhone, SmsResponseStrings.Quit_AllRemoved(base.ExistingSubscriberPhone)); Assert.AreEqual(0, store.Subscriptions.Count()); }