GetListsFromSubscriber() public method

public GetListsFromSubscriber ( string email ) : List
email string
return List
        public void TheBigTest()
        {
            string emailToTestWith = "*****@*****.**";

            Upac.CampaignMonitor.Api api = new Upac.CampaignMonitor.Api();
            List<List> lists = api.GetLists();

            Assert.GreaterOrEqual(lists.Count, 2);

            foreach (List list in lists)
            {
                Console.WriteLine("Adding {0} to list {1}", emailToTestWith, list.ListID);
                bool added = api.AddSubscriber(emailToTestWith, string.Empty, list.ListID);
                Assert.IsTrue(added);
            }

            List<string> subscriberLists = api.GetListsFromSubscriber(emailToTestWith);
            Assert.AreEqual(lists.Count, subscriberLists.Count);

            bool isSubscribed = api.IsSubscribed(emailToTestWith, lists[0].ListID);
            Assert.IsTrue(isSubscribed);

            api.RemoveSubscriberFromList(emailToTestWith, lists[0].ListID);
            subscriberLists = api.GetListsFromSubscriber(emailToTestWith);
            Assert.AreEqual(lists.Count - 1, subscriberLists.Count);

            isSubscribed = api.IsSubscribed(emailToTestWith, lists[1].ListID);
            Assert.IsTrue(isSubscribed);
        }
Beispiel #2
0
        public void TheBigTest()
        {
            string emailToTestWith = "*****@*****.**";

            Upac.CampaignMonitor.Api api = new Upac.CampaignMonitor.Api();
            List <List> lists            = api.GetLists();

            Assert.GreaterOrEqual(lists.Count, 2);

            foreach (List list in lists)
            {
                Console.WriteLine("Adding {0} to list {1}", emailToTestWith, list.ListID);
                bool added = api.AddSubscriber(emailToTestWith, string.Empty, list.ListID);
                Assert.IsTrue(added);
            }

            List <string> subscriberLists = api.GetListsFromSubscriber(emailToTestWith);

            Assert.AreEqual(lists.Count, subscriberLists.Count);

            bool isSubscribed = api.IsSubscribed(emailToTestWith, lists[0].ListID);

            Assert.IsTrue(isSubscribed);

            api.RemoveSubscriberFromList(emailToTestWith, lists[0].ListID);
            subscriberLists = api.GetListsFromSubscriber(emailToTestWith);
            Assert.AreEqual(lists.Count - 1, subscriberLists.Count);

            isSubscribed = api.IsSubscribed(emailToTestWith, lists[1].ListID);
            Assert.IsTrue(isSubscribed);
        }