Esempio n. 1
0
        public void SubscribeWithGroupSelection_Successful()
        {
            //  Arrange
            MailChimpManager mc    = new MailChimpManager(TestGlobal.Test_APIKey);
            ListResult       lists = mc.GetLists();
            EmailParameter   email = new EmailParameter()
            {
                Email = "*****@*****.**"
            };

            // find a list with interest groups...
            string strListID    = null;
            int    nGroupingID  = 0;
            string strGroupName = null;

            foreach (ListInfo li in lists.Data)
            {
                List <InterestGrouping> interests = mc.GetListInterestGroupings(li.Id);
                if (interests != null)
                {
                    if (interests.Count > 0)
                    {
                        if (interests[0].GroupNames.Count > 0)
                        {
                            strListID    = li.Id;
                            nGroupingID  = interests[0].Id;
                            strGroupName = interests[0].GroupNames[0].Name;
                            break;
                        }
                    }
                }
            }
            Assert.IsNotNull(strListID, "no lists found in this account with groupings / group names");
            Assert.AreNotEqual(0, nGroupingID);
            Assert.IsNotNull(strGroupName);

            MyMergeVar mvso = new MyMergeVar();

            mvso.Groupings = new List <Grouping>();
            mvso.Groupings.Add(new Grouping());
            mvso.Groupings[0].Id         = nGroupingID;
            mvso.Groupings[0].GroupNames = new List <string>();
            mvso.Groupings[0].GroupNames.Add(strGroupName);
            mvso.FirstName = "Testy";
            mvso.LastName  = "Testerson";

            //  Act
            EmailParameter results = mc.Subscribe(strListID, email, mvso);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(!string.IsNullOrEmpty(results.LEId));
        }
Esempio n. 2
0
        public void GetListInterestGroupings_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager("efb48a02f2f56120e2f3f6e2fef71803-us6");
            ListResult lists = mc.GetLists(new ListFilter(){ListName = "TestAPIGetInterestGroup"});
            Assert.IsNotNull(lists);
            Assert.IsTrue(lists.Data.Any());
            //  Act
            List<InterestGrouping> results = mc.GetListInterestGroupings(lists.Data.FirstOrDefault().Id);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(results.Any());
        }
Esempio n. 3
0
        public void GetListInterestGroupings_Successful()
        {
            //  Arrange
            MailChimpManager mc    = new MailChimpManager(TestGlobal.Test_APIKey);
            ListResult       lists = mc.GetLists(new ListFilter()
            {
                ListName = "TestAPIGetInterestGroup"
            });

            Assert.IsNotNull(lists);
            Assert.IsTrue(lists.Data.Any());
            //  Act
            List <InterestGrouping> results = mc.GetListInterestGroupings(lists.Data.FirstOrDefault().Id);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(results.Any());
        }
Esempio n. 4
0
        public void GetListInterestGroupingsWithCountRequested_Successful()
        {
            //  Arrange
            MailChimpManager mc    = new MailChimpManager("efb48a02f2f56120e2f3f6e2fef71803-us6");
            ListResult       lists = mc.GetLists(new ListFilter()
            {
                ListName = "TestAPIGetInterestGroup"
            });

            Assert.IsNotNull(lists);
            Assert.IsTrue(lists.Data.Any());
            //  Act
            List <InterestGrouping> results = mc.GetListInterestGroupings(lists.Data.FirstOrDefault().Id, true);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(results.Any());
        }
Esempio n. 5
0
    public static IEnumerable ListsInterestGroupings(SqlString apikey, SqlString list_id, SqlBoolean counts)
    {
        List <InterestGroupingRow> rows = new List <InterestGroupingRow>();

        MailChimpManager mc = new MailChimpManager(apikey.ToString());

        List <InterestGrouping> results = mc.GetListInterestGroupings(list_id.ToString(), counts.IsTrue);

        foreach (InterestGrouping grouping in results)
        {
            foreach (InterestGrouping.InnerGroup innerGroup in grouping.GroupNames)
            {
                InterestGroupingRow row = new InterestGroupingRow();
                row.Id           = grouping.Id;
                row.Name         = grouping.Name;
                row.GroupName    = innerGroup.Name;
                row.DisplayOrder = innerGroup.DisplayOrder;
                row.Subscribers  = innerGroup.Subscribers;
                rows.Add(row);
            }
        }

        return(rows);
    }
Esempio n. 6
0
        public void SubscribeWithGroupSelectionUsingDictonary_Successful()
        {
            //  Arrange
            MailChimpManager mc    = new MailChimpManager(TestGlobal.Test_APIKey);
            ListResult       lists = mc.GetLists();
            EmailParameter   email = new EmailParameter()
            {
                Email = "*****@*****.**"
            };

            // find a list with interest groups...
            string strListID    = null;
            int    nGroupingID  = 0;
            string strGroupName = null;

            foreach (ListInfo li in lists.Data)
            {
                List <InterestGrouping> interests = mc.GetListInterestGroupings(li.Id);
                if (interests != null)
                {
                    if (interests.Count > 0)
                    {
                        if (interests[0].GroupNames.Count > 0)
                        {
                            strListID    = li.Id;
                            nGroupingID  = interests[0].Id;
                            strGroupName = interests[0].GroupNames[0].Name;
                            break;
                        }
                    }
                }
            }
            Assert.IsNotNull(strListID, "no lists found in this account with groupings / group names");
            Assert.AreNotEqual(0, nGroupingID);
            Assert.IsNotNull(strGroupName);

            MergeVar mvso = new MergeVar();

            mvso.Groupings = new List <Grouping>();
            mvso.Groupings.Add(new Grouping());
            mvso.Groupings[0].Id         = nGroupingID;
            mvso.Groupings[0].GroupNames = new List <string>();
            mvso.Groupings[0].GroupNames.Add(strGroupName);
            mvso.Add("FNAME", "Testy" + DateTime.Now);
            mvso.Add("LNAME", "Testerson" + DateTime.Now);

            //  Act
            EmailParameter results = mc.Subscribe(strListID, email, mvso);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(!string.IsNullOrEmpty(results.LEId));

            // load
            List <EmailParameter> emails = new List <EmailParameter>();

            emails.Add(results);
            MemberInfoResult memberInfos = mc.GetMemberInfo(strListID, emails);

            // Assert
            Assert.AreEqual(1, memberInfos.SuccessCount);
            Assert.AreEqual(2, memberInfos.Data[0].MemberMergeInfo.Count);
            Assert.AreEqual(mvso["FNAME"], memberInfos.Data[0].MemberMergeInfo["FNAME"]);
            Assert.AreEqual(mvso["LNAME"], memberInfos.Data[0].MemberMergeInfo["LNAME"]);
        }
Esempio n. 7
0
        public void SubscribeWithGroupSelection_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
            ListResult lists = mc.GetLists();
            EmailParameter email = new EmailParameter()
            {
                Email = "*****@*****.**"
            };

            // find a list with interest groups...
            string strListID = null;
            int nGroupingID = 0;
            string strGroupName = null;
            foreach (ListInfo li in lists.Data) {
                List<InterestGrouping> interests = mc.GetListInterestGroupings(li.Id);
                if (interests != null) {
                    if (interests.Count > 0) {
                        if (interests[0].GroupNames.Count > 0) {
                            strListID = li.Id;
                            nGroupingID = interests[0].Id;
                            strGroupName = interests[0].GroupNames[0].Name;
                            break;
                        }
                    }
                }
            }
            Assert.IsNotNull(strListID,"no lists found in this account with groupings / group names");
            Assert.AreNotEqual(0,nGroupingID);
            Assert.IsNotNull(strGroupName);

            MyMergeVar mvso = new MyMergeVar();
            mvso.Groupings = new List<Grouping>();
            mvso.Groupings.Add(new Grouping());
            mvso.Groupings[0].Id = nGroupingID;
            mvso.Groupings[0].GroupNames = new List<string>();
            mvso.Groupings[0].GroupNames.Add(strGroupName);
            mvso.FirstName = "Testy";
            mvso.LastName = "Testerson";

            //  Act
            EmailParameter results = mc.Subscribe(strListID, email, mvso);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(!string.IsNullOrEmpty(results.LEId));
        }
Esempio n. 8
0
        public void GetListInterestGroupings_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
            ListResult lists = mc.GetLists(new ListFilter(){ListName = "TestAPIGetInterestGroup"});
            Assert.IsNotNull(lists);
            Assert.IsTrue(lists.Data.Any());
            //  Act
            List<InterestGrouping> results = mc.GetListInterestGroupings(lists.Data.FirstOrDefault().Id);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(results.Any());
        }
Esempio n. 9
0
				public void SubscribeWithGroupSelectionUsingDictonary_Successful() {
					//  Arrange
					MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
					ListResult lists = mc.GetLists();
					EmailParameter email = new EmailParameter() {
						Email = "*****@*****.**"
					};

					// find a list with interest groups...
					string strListID = null;
					int nGroupingID = 0;
					string strGroupName = null;
					foreach (ListInfo li in lists.Data) {
						List<InterestGrouping> interests = mc.GetListInterestGroupings(li.Id);
						if (interests != null) {
							if (interests.Count > 0) {
								if (interests[0].GroupNames.Count > 0) {
									strListID = li.Id;
									nGroupingID = interests[0].Id;
									strGroupName = interests[0].GroupNames[0].Name;
									break;
								}
							}
						}
					}
					Assert.IsNotNull(strListID, "no lists found in this account with groupings / group names");
					Assert.AreNotEqual(0, nGroupingID);
					Assert.IsNotNull(strGroupName);

					MergeVar mvso = new MergeVar();
					mvso.Groupings = new List<Grouping>();
					mvso.Groupings.Add(new Grouping());
					mvso.Groupings[0].Id = nGroupingID;
					mvso.Groupings[0].GroupNames = new List<string>();
					mvso.Groupings[0].GroupNames.Add(strGroupName);
					mvso.Add("FNAME","Testy" + DateTime.Now);
					mvso.Add("LNAME", "Testerson" + DateTime.Now);

					//  Act
					EmailParameter results = mc.Subscribe(strListID, email, mvso);

					//  Assert
					Assert.IsNotNull(results);
					Assert.IsTrue(!string.IsNullOrEmpty(results.LEId));

					// load
					List<EmailParameter> emails = new List<EmailParameter>();
					emails.Add(results);
					MemberInfoResult memberInfos = mc.GetMemberInfo(strListID, emails);

					// Assert
					Assert.AreEqual(1, memberInfos.SuccessCount);
					Assert.AreEqual(2, memberInfos.Data[0].MemberMergeInfo.Count);
					Assert.AreEqual(mvso["FNAME"], memberInfos.Data[0].MemberMergeInfo["FNAME"]);
					Assert.AreEqual(mvso["LNAME"], memberInfos.Data[0].MemberMergeInfo["LNAME"]);

				}