本文整理汇总了C#中MailChimpManager.AddMergeVar方法的典型用法代码示例。如果您正苦于以下问题:C# MailChimpManager.AddMergeVar方法的具体用法?C# MailChimpManager.AddMergeVar怎么用?C# MailChimpManager.AddMergeVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailChimpManager
的用法示例。
在下文中一共展示了MailChimpManager.AddMergeVar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetMergeVar_Successful
public void SetMergeVar_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
// we don't want to have an existing merge var interfere
try { mc.DeleteMergeVar(lists.Data.First().Id, "TESTSET"); }
catch { }
mc.AddMergeVar(lists.Data.First().Id, "TESTSET", "Test Value");
// Act
CompleteResult result = mc.SetMergeVar(lists.Data.First().Id, "TESTSET", "Set");
// Assert
Assert.IsNotNull(result);
Assert.IsTrue(result.Complete);
// Clean up
mc.DeleteMergeVar(lists.Data.First().Id, "TESTSET");
}
示例2: DeleteMergeVar_Successful
public void DeleteMergeVar_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
mc.AddMergeVar(lists.Data.First().Id, "TESTDELETE", "Test Value");
// Act
CompleteResult result = mc.DeleteMergeVar(lists.Data.First().Id, "TESTDELETE");
// Assert
Assert.IsNotNull(result);
Assert.IsTrue(result.Complete);
}
示例3: GetMergeVars_Successful
public void GetMergeVars_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
// we don't want to have an existing merge var interfere
try { mc.DeleteMergeVar(lists.Data.First().Id, "TESTGETVAR"); }
catch { }
MergeVarOptions options = new MergeVarOptions()
{
FieldType = "url",
HelpText = "A url, such as https://github.com/danesparza/MailChimp.NET"
};
mc.AddMergeVar(lists.Data.First().Id, "TESTGETVAR", "Test Value", options);
// Act
MergeVarResult result = mc.GetMergeVars(lists.Data.Select(l => l.Id));
// Assert
Assert.IsNotNull(result.Data);
Assert.IsTrue(result.Data.Any(d => d.MergeVars.Any(m => m.Tag == "TESTGETVAR")));
// Clean up
mc.DeleteMergeVar(lists.Data.First().Id, "TESTGETVAR");
}
示例4: UpdateMergeVar_Successful
public void UpdateMergeVar_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
MergeVarOptions options = new MergeVarOptions()
{
FieldType = "url",
HelpText = "A url, such as https://github.com/danesparza/MailChimp.NET"
};
// we don't want to have existing merge vars interfere
try { mc.DeleteMergeVar(lists.Data.First().Id, "TESTUPDVAR"); }
catch { }
try { mc.DeleteMergeVar(lists.Data.First().Id, "UPDATEDVAR"); }
catch { }
mc.AddMergeVar(lists.Data.First().Id, "TESTUPDVAR", "Test Value", options);
// Act
options = new MergeVarOptions()
{
Tag = "UPDATEDVAR",
HelpText = "Any url you like"
};
MergeVarItemResult result = mc.UpdateMergeVar(lists.Data.First().Id, "TESTUPDVAR", options);
// Assert
Assert.IsNotNull(result);
Assert.IsTrue(result.Tag == "UPDATEDVAR");
// Clean up
mc.DeleteMergeVar(lists.Data.First().Id, "UPDATEDVAR");
}
示例5: AddMergeVar_Successful
public void AddMergeVar_Successful()
{
// Arrange
MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
ListResult lists = mc.GetLists();
MergeVarOptions options = new MergeVarOptions()
{
FieldType = "url",
HelpText = "A url, such as https://github.com/danesparza/MailChimp.NET"
};
// Act
MergeVarItemResult result = mc.AddMergeVar(lists.Data.First().Id, "TESTVALUE", "Test Value", options);
// Assert
Assert.IsNotNull(result);
}