コード例 #1
0
        public void CustomVariable_Constructor_Sets_Properties()
        {
            var customVariable = new CustomVariable("name", "value");

            Assert.AreEqual("name", customVariable.Name);
            Assert.AreEqual("value", customVariable.Value);
        }
コード例 #2
0
        public void UrchinTracker_GetFinalCustomVariables_Selects_Correct_Final_Variables()
        {
            var sessionScopedVariables = new ScopedCustomVariableSlots(CustomVariableScope.Session);
            sessionScopedVariables[0] = new CustomVariable("session-one-name", "session-one-value");
            sessionScopedVariables[2] = new CustomVariable("session-three-name", "session-three-value");

            var visitorScopedVariables = new ScopedCustomVariableSlots(CustomVariableScope.Visitor);
            visitorScopedVariables[0] = new CustomVariable("Visitor-one-name", "Visitor-one-value");
            visitorScopedVariables[1] = new CustomVariable("Visitor-two-name", "Visitor-two-value");

            var activityScopedVariables = new ScopedCustomVariableSlots(CustomVariableScope.Activity);
            activityScopedVariables[0] = new CustomVariable("activity-one-name", "activity-one-value");
            activityScopedVariables[1] = new CustomVariable("activity-two-name", "activity-two-value");
            activityScopedVariables[3] = new CustomVariable("activity-four-name", "activity-four-value");

            var final = UrchinTracker.GetFinalCustomVariables(sessionScopedVariables, visitorScopedVariables, activityScopedVariables);

            Assert.AreEqual(CustomVariableScope.Visitor, final[0].Scope);
            Assert.AreEqual(CustomVariableScope.Visitor, final[1].Scope);
            Assert.AreEqual(CustomVariableScope.Session, final[2].Scope);
            Assert.AreEqual(CustomVariableScope.Activity, final[3].Scope);

            Assert.AreEqual("Visitor-one-name", final[0].Variable.Name);
            Assert.AreEqual("Visitor-two-name", final[1].Variable.Name);
            Assert.AreEqual("session-three-name", final[2].Variable.Name);
            Assert.AreEqual("activity-four-name", final[3].Variable.Name);

            Assert.AreEqual(3, final.GetUpperBound(0));
        }
コード例 #3
0
        public void ScopedCustomVariableSlots_Slots_Can_Be_Set()
        {
            var slotOne = new CustomVariable("one", "1");
            var slotTwo = new CustomVariable("two", "2");
            var slotThree = new CustomVariable("three", "3");
            var slotFour = new CustomVariable("four", "4");
            var slotFive = new CustomVariable("five", "5");

            var slots = new ScopedCustomVariableSlots(CustomVariableScope.Session);
            slots[0] = slotOne;
            slots[1] = slotTwo;
            slots[2] = slotThree;
            slots[3] = slotFour;
            slots[4] = slotFive;

            Assert.AreSame(slotOne, slots[0]);
            Assert.AreSame(slotTwo, slots[1]);
            Assert.AreSame(slotThree, slots[2]);
            Assert.AreSame(slotFour, slots[3]);
            Assert.AreSame(slotFive, slots[4]);
        }
コード例 #4
0
        public void ScopedCustomVariable_Slot_Properties_Can_Be_Set()
        {
            var scopedCustomVariableSlots = new ScopedCustomVariableSlots(CustomVariableScope.Session);
            var slot1 = new CustomVariable("name1", "value1");
            var slot2 = new CustomVariable("name2", "value2");
            var slot3 = new CustomVariable("name3", "value3");
            var slot4 = new CustomVariable("name4", "value4");
            var slot5 = new CustomVariable("name5", "value5");

            scopedCustomVariableSlots[0] = slot1;
            scopedCustomVariableSlots[1] = slot2;
            scopedCustomVariableSlots[2] = slot3;
            scopedCustomVariableSlots[3] = slot4;
            scopedCustomVariableSlots[4] = slot5;

            Assert.AreSame(slot1, scopedCustomVariableSlots[0]);
            Assert.AreSame(slot2, scopedCustomVariableSlots[1]);
            Assert.AreSame(slot3, scopedCustomVariableSlots[2]);
            Assert.AreSame(slot4, scopedCustomVariableSlots[3]);
            Assert.AreSame(slot5, scopedCustomVariableSlots[4]);
        }