コード例 #1
0
        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);
        }