Ejemplo n.º 1
0
        public void LiveActivityGetSummaryReportTest()
        {
            var cc = new ConstantContact(ApiKey, AccessToken);
            var add = new AddContacts(
                new List<AddContactsImportData>{
                    new AddContactsImportData{
                        EmailAddresses = new List<string>{ String.Format("{0}@example.com", Guid.NewGuid()) }
                    }
                },
                new List<string> { "1" },
                null
                );
            Activity act = cc.CreateAddContactsActivity(add);
            Assert.IsNotNull(act);

            IList<Activity> list = cc.GetActivities();
            foreach (Activity activity in list)
            {
                Activity a = cc.GetActivity(activity.Id);
                Assert.IsNotNull(a);
            }
        }
Ejemplo n.º 2
0
        public void LiveActivityClearListTest()
        {
            var cc = new ConstantContact(ApiKey, AccessToken);
            var emailAddresses = new List<string> { String.Format("{0}@example.com", Guid.NewGuid()) };
            var lists = new List<string> { "2" };

            var add = new AddContacts(
                new List<AddContactsImportData>{
                    new AddContactsImportData{
                        EmailAddresses = emailAddresses
                    }
                },
                lists,
                null
                );
            Activity act = cc.CreateAddContactsActivity(add);
            Assert.IsNotNull(act);

            Activity activity = cc.AddClearListsActivity(lists);

            Assert.IsNotNull(activity);
            Assert.AreEqual(activity.Type, "CLEAR_CONTACTS_FROM_LISTS");
        }
Ejemplo n.º 3
0
 public void LiveActivityAddContactTest()
 {
     var cc = new ConstantContact(ApiKey, AccessToken);
     var add = new AddContacts(
         new List<AddContactsImportData>{
             new AddContactsImportData{
                 EmailAddresses = new List<string>{ String.Format("{0}@example.com", Guid.NewGuid()) }
             }
         },
         new List<string> { "1" },
         null
         );
     var act = cc.CreateAddContactsActivity(add);
     Assert.IsNotNull(act);
 }
Ejemplo n.º 4
0
        public void LiveActivityRemoveContactTest()
        {
            var cc = new ConstantContact(ApiKey, AccessToken);
            var emailAddresses = new List<string>{ String.Format("{0}@example.com", Guid.NewGuid()) };
            var lists = new List<string> { "2" };

            var add = new AddContacts(
                new List<AddContactsImportData>{
                    new AddContactsImportData{
                        EmailAddresses = emailAddresses
                    }
                },
                lists,
                null
                );
            Activity act = cc.CreateAddContactsActivity(add);
            Assert.IsNotNull(act);

            Activity activity = cc.AddRemoveContactsFromListsActivity(emailAddresses, lists);

            Assert.IsNotNull(activity);
            Assert.AreEqual(activity.ContactCount, emailAddresses.Count);
        }
Ejemplo n.º 5
0
		public void LiveActivityRemoveContactsMultipartTest()
		{
			var cc = new ConstantContact(ApiKey, AccessToken);

			var filename = "remove_contacts.csv";
			var fileContent = String.Format("{0}@example.com", Guid.NewGuid());
			var content = Encoding.UTF8.GetBytes(fileContent);
			var lists = new List<string>() { "1" };

			 var add = new AddContacts(
                new List<AddContactsImportData>{
                    new AddContactsImportData{
                        EmailAddresses = new List<string> { fileContent }
                    }
                },
                lists,
                null
                );

            Activity act = cc.CreateAddContactsActivity(add);
			Activity activity = cc.RemoveContactsMultipartActivity(filename, content, lists);

			Assert.IsNotNull(activity);
			Assert.IsNotNull(activity.Id);
			Assert.AreEqual(activity.ContactCount, 1);
			Assert.AreEqual(activity.Type, "REMOVE_CONTACTS_FROM_LISTS");		
		}