AddSubscriber() public method

public AddSubscriber ( string email, string name, string listId ) : bool
email string
name string
listId string
return bool
Ejemplo n.º 1
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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        public void TestAddSubscriberAndRemoveSubscriberFromList()
        {
            // First add
            Upac.CampaignMonitor.Api api = new Upac.CampaignMonitor.Api();
            List<List> lists = api.GetLists();
            foreach (List list in lists)
            {
                Console.WriteLine("Adding {0} to list {1}", "*****@*****.**", list.ListID);
                bool added = api.AddSubscriber("*****@*****.**", "Christian Palm", list.ListID);
                Assert.IsTrue(added);
            }

            // Then remove
            foreach (List list in lists)
            {
                Console.WriteLine("Removing {0} from list {1}", "*****@*****.**", list.ListID);
                bool removed = api.RemoveSubscriberFromList("*****@*****.**", list.ListID);
                Assert.IsTrue(removed);
            }
        }
Ejemplo n.º 4
0
        public void TestAddSubscriberAndRemoveSubscriberFromList()
        {
            // First add
            Upac.CampaignMonitor.Api api = new Upac.CampaignMonitor.Api();
            List <List> lists            = api.GetLists();

            foreach (List list in lists)
            {
                Console.WriteLine("Adding {0} to list {1}", "*****@*****.**", list.ListID);
                bool added = api.AddSubscriber("*****@*****.**", "Christian Palm", list.ListID);
                Assert.IsTrue(added);
            }

            // Then remove
            foreach (List list in lists)
            {
                Console.WriteLine("Removing {0} from list {1}", "*****@*****.**", list.ListID);
                bool removed = api.RemoveSubscriberFromList("*****@*****.**", list.ListID);
                Assert.IsTrue(removed);
            }
        }