예제 #1
0
        public void LiveGetContactFromListTest()
        {
            var cc = new ConstantContact(ApiKey, AccessToken);

            IList<ContactList> lists = cc.GetLists(DateTime.Now.AddMonths(-1));
            Assert.IsNotNull(lists);
            Assert.AreNotEqual(0, lists.Count);

            ResultSet<Contact> contacts = cc.GetContactsFromList(lists[0].Id, DateTime.Now.AddMonths(-1));
            Assert.IsNotNull(contacts);
            Assert.IsNotNull(contacts.Results);

            contacts = cc.GetContactsFromList(lists[0].Id, 3, DateTime.Now.AddMonths(-1));
            Assert.IsNotNull(contacts);
            Assert.IsNotNull(contacts.Meta);
            Assert.IsNotNull(contacts.Meta.Pagination);
            Assert.IsNotNull(contacts.Meta.Pagination.Next);
            Assert.IsNotNull(contacts.Results);
            Assert.AreEqual(3, contacts.Results.Count);

            contacts = cc.GetContactsFromList(DateTime.Now.AddMonths(-1), contacts.Meta.Pagination);
            Assert.IsNotNull(contacts);
            Assert.IsNotNull(contacts.Meta);
            Assert.IsNotNull(contacts.Meta.Pagination);
            Assert.IsNotNull(contacts.Meta.Pagination.Next);
            Assert.IsNotNull(contacts.Results);
            Assert.AreEqual(3, contacts.Results.Count);
        }