Ejemplo n.º 1
0
        public void UrchinActivityParameterBuilder_GetParameter_For_EventActivity_Returns_Correctly_Encoded_Utme_Value()
        {
            var activity = new EventActivity("*)!", "a*b)c!d'2", label: "*", value: 1);

            var actual = UrchinActivityParameterBuilder.GetParameters(activity).First(f => f.Key == "utme").Value;

            Assert.AreEqual("5(a'2b'1c'3d'02*'2'1'3*'2)(1)", actual);
        }
Ejemplo n.º 2
0
        public void UrchinActivityParameterBuilder_GetParameter_For_ItemActivity_Returns_Correct_Optional_Values()
        {
            var activity = new TransactionItemActivity("code", "name", 1.23m, 4, "variation");

            var parameters = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value);

            Assert.AreEqual("variation", parameters["utmiva"]);
        }
Ejemplo n.º 3
0
        public void UrchinActivityParameterBuilder_GetParameter_For_PageViewActivity_Returns_No_Utmt_Value()
        {
            var activity = new PageViewActivity("title", "page");

            var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v);

            CollectionAssert.DoesNotContain(results.Keys, "utmt");
        }
Ejemplo n.º 4
0
        public void UrchinActivityParameterBuilder_GetParameter_For_CampaignActivity_Returns_Correct_Values()
        {
            var activity = new CampaignActivity("source");

            var parameters = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value);

            Assert.AreEqual("source", parameters["utmcsr"]);
        }
Ejemplo n.º 5
0
        public void UrchinActivityParameterBuilder_GetParameter_For_EventActivity_With_Four_Parameters_Returns_Correct_Utme_Value()
        {
            var activity = new EventActivity("action", "category", label: "label", value: 1234);

            var actual = UrchinActivityParameterBuilder.GetParameters(activity).First(f => f.Key == "utme").Value;

            Assert.AreEqual("5(category*action*label)(1234)", actual);
        }
Ejemplo n.º 6
0
        public void UrchinActivityParameterBuilder_GetParameter_For_EventActivity_Returns_Correct_Utmt_Value()
        {
            var activity = new EventActivity("action", "category");

            var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v);

            CollectionAssert.Contains(results.Keys, "utmt");
            Assert.AreEqual("event", results["utmt"].Value);
        }
Ejemplo n.º 7
0
        public void UrchinActivityParameterBuilder_GetParameter_For_SocialActivity_Returns_Correct_Optional_Values()
        {
            var activity = new SocialActivity("action", "network", pagePath: "pagePath", target: "target");

            var parameters = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value);

            Assert.AreEqual("target", parameters["utmsid"]);
            Assert.AreEqual("pagePath", parameters["utmp"]);
        }
Ejemplo n.º 8
0
        public void UrchinActivityParameterBuilder_GetParameter_For_SocialActivity_Returns_Correct_Values()
        {
            var activity = new SocialActivity("action", "network");

            var parameters = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value);

            Assert.AreEqual("network", parameters["utmsn"]);
            Assert.AreEqual("action", parameters["utmsa"]);
        }
Ejemplo n.º 9
0
        public void UrchinActivityParameterBuilder_GetParameter_For_ItemActivity_Returns_Correct_Utmt_Value()
        {
            var activity = new TransactionItemActivity("code", "name", 1.23m, 1);

            var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v);

            CollectionAssert.Contains(results.Keys, "utmt");
            Assert.AreEqual("item", results["utmt"].Value);
        }
Ejemplo n.º 10
0
        public void UrchinActivityParameterBuilder_GetParameter_For_EventActivity_Returns_Correct_Keys()
        {
            var activity = new EventActivity("action", "category", nonInteraction: true);

            var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v);

            var expectedKeys = new[] { "utmt", "utme", "utmi" };

            CollectionAssert.AreEquivalent(expectedKeys, results.Keys);
        }
Ejemplo n.º 11
0
        public void UrchinActivityParameterBuilder_GetParameter_For_CampaignActivity_Returns_Correct_Keys_When_Not_IsNewVisit()
        {
            var activity = new CampaignActivity("source");

            var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v);

            var expectedKeys = new[] { "utmcsr", "utmcr" };

            CollectionAssert.AreEquivalent(expectedKeys, results.Keys);
        }
Ejemplo n.º 12
0
        public void UrchinActivityParameterBuilder_GetParameter_For_TimedEventActivity_Returns_Correct_Keys()
        {
            var activity = new TimedEventActivity("category", "variable", TimeSpan.FromSeconds(1.5), "label");

            var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v);

            var expectedKeys = new[] { "utmt", "utme" };

            CollectionAssert.AreEquivalent(expectedKeys, results.Keys);
        }
Ejemplo n.º 13
0
        public void UrchinActivityParameterBuilder_GetParameter_For_SocialActivity_Returns_Correct_Keys()
        {
            var activity = new SocialActivity("action", "network", pagePath: "pagePath", target: "target");

            var actualKeys = UrchinActivityParameterBuilder.GetParameters(activity).Select(k => k.Key).ToArray();

            var expectedKeys = new[] { "utmsn", "utmsa", "utmsid", "utmp", "utmt" };

            CollectionAssert.AreEquivalent(expectedKeys, actualKeys);
        }
Ejemplo n.º 14
0
        public void UrchinActivityParameterBuilder_GetParameter_For_PageViewActivity_Returns_Correct_Keys()
        {
            var activity = new PageViewActivity("title", "page");

            var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v);

            var expectedKeys = new[] { "utmp", "utmdt" };

            CollectionAssert.AreEquivalent(expectedKeys, results.Keys);
        }
Ejemplo n.º 15
0
        public void UrchinActivityParameterBuilder_GetParameter_For_ItemActivity_Returns_Correct_Keys()
        {
            var activity = new TransactionItemActivity("code", "name", 1.23m, 4, "variation");

            var results = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v);

            var expectedKeys = new[] { "utmt", "utmipc", "utmipn", "utmipr", "utmiqt", "utmiva" };

            CollectionAssert.AreEquivalent(expectedKeys, results.Keys);
        }
Ejemplo n.º 16
0
        public void UrchinActivityParameterBuilder_GetParameter_For_CampaignActivity_Returns_Correct_Optional_Values()
        {
            var activity = new CampaignActivity("source")
            {
                Name    = "name",
                Medium  = "medium",
                Term    = "term",
                Content = "content"
            };

            var parameters = UrchinActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value);

            Assert.AreEqual("source", parameters["utmcsr"]);
            Assert.AreEqual("name", parameters["utmccn"]);
            Assert.AreEqual("medium", parameters["utmcmd"]);
            Assert.AreEqual("term", parameters["utmctr"]);
            Assert.AreEqual("content", parameters["utmcct"]);
        }