本文整理汇总了C#中MailChimpManager.GetListInterestGroupings方法的典型用法代码示例。如果您正苦于以下问题:C# MailChimpManager.GetListInterestGroupings方法的具体用法?C# MailChimpManager.GetListInterestGroupings怎么用?C# MailChimpManager.GetListInterestGroupings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailChimpManager
的用法示例。
在下文中一共展示了MailChimpManager.GetListInterestGroupings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetListInterestGroupings_Successful
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());
}
示例2: GetListInterestGroupings_Successful
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());
}
示例3: SubscribeWithGroupSelection_Successful
public void SubscribeWithGroupSelection_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
EmailParameter email = new EmailParameter()
{
Email = "[email protected]"
};
// 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));
}
示例4: SubscribeWithGroupSelectionUsingDictonary_Successful
public void SubscribeWithGroupSelectionUsingDictonary_Successful() {
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
EmailParameter email = new EmailParameter() {
Email = "[email protected]"
};
// 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"]);
}