Пример #1
0
        public void TestSubscribeWithGroupingsAndMergeVarsAndCustomListId(string emailPattern, int numberOfEmails)
        {
            IMailChimpApiService mailChimpApiService = new MailChimpApiService(MailChimpServiceConfiguration.Settings.ApiKey);
            const string customListId = "71d6c2a0f0";
            for (int i = 0; i < numberOfEmails; i++)
            {
                var subscribeSources = new Grouping {Name = "Subscribe Source"};
                subscribeSources.Groups.Add("Site");

                var couponsGained = new Grouping {Name = "Coupons Gained"};
                couponsGained.Groups.Add("Coupon1");

                var interests = new Grouping {Name = "Interests"};
                interests.Groups.Add("Extreme Games");


                var fields = new Dictionary<string, string>
                    {
                        {"GENDER", "Male"},
                        {"DATEBORN", DateTime.Now.ToString(CultureInfo.InvariantCulture)},
                        {"CITY", "Athens"},
                        {"COUNTRY", "Greece"}
                    };

                var response = mailChimpApiService.Subscribe(String.Format(emailPattern, i), 
                    customListId,
                    new List<Grouping>() { subscribeSources, couponsGained, interests }, 
                    fields, 
                    false);

                Console.WriteLine(response.ResponseJson);
                Assert.AreEqual(true, response.IsSuccesful);
            }
        }
Пример #2
0
        public void TestPing()
        {
            IMailChimpApiService mailChimpApiService = new MailChimpApiService(MailChimpServiceConfiguration.Settings.ApiKey);

            var response = mailChimpApiService.PingMailChimpServer();
            Console.WriteLine(response.ResponseJson);
            Assert.AreEqual(true, response.IsSuccesful);
        }
Пример #3
0
 public void TestSubscribe(string emailPattern, int numberOfEmails)
 {
     IMailChimpApiService mailChimpApiService = new MailChimpApiService(MailChimpServiceConfiguration.Settings.ApiKey);
     for (int i = 0; i < numberOfEmails; i++)
     {
         var response = mailChimpApiService.Subscribe(String.Format(emailPattern, i), false);
         Console.WriteLine(response.ResponseJson);
         Assert.AreEqual(true, response.IsSuccesful);
     }
 }