本文整理汇总了C#中IHeader.JsonString方法的典型用法代码示例。如果您正苦于以下问题:C# IHeader.JsonString方法的具体用法?C# IHeader.JsonString怎么用?C# IHeader.JsonString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHeader
的用法示例。
在下文中一共展示了IHeader.JsonString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertHeader
private void AssertHeader(IHeader header)
{
var headerObj = JsonObject.Parse(header.JsonString());
var subs = headerObj.Object("sub");
var firstNameSubstitutions = subs.Get<string[]>(FirstNamePlaceholder).ToList();
CollectionAssert.AreEqual(new List<string> { Subscriber1FirstName, Subscriber2FirstName }, firstNameSubstitutions);
var lastNameSubstitutions = subs.Get<string[]>(LastNamePlaceholder).ToList();
CollectionAssert.AreEqual(new List<string> { "", Subscriber2LastName }, lastNameSubstitutions);
var emailSubstitutions = subs.Get<string[]>(EmailPlaceholder).ToList();
CollectionAssert.AreEqual(new List<string> { Subscriber1Email, Subscriber2Email }, emailSubstitutions);
var resolveKeySubstitutions = subs.Get<string[]>(ResolveKeyPlaceholder).ToList();
CollectionAssert.AreEqual(new List<string> { Subscriber1ResolveKey, Subscriber2ResolveKey }, resolveKeySubstitutions);
var uniqueArgs = headerObj.Object("unique_args");
var campaingId = uniqueArgs.Get(CampaignCustomHeaderKey);
Assert.AreEqual(CampaignCustomHeaderValue, campaingId);
var subscriberId = uniqueArgs.Get(SubscriberCustomHeaderKey);
Assert.AreEqual(SubscriberCustomHeaderValue, subscriberId);
}