Inheritance: ICustomVariable
        public void CustomVariable_Constructor_Sets_Properties()
        {
            var customVariable = new CustomVariable("name", "value");

            Assert.AreEqual("name", customVariable.Name);
            Assert.AreEqual("value", customVariable.Value);
        }
        public void UrchinUriBuilder_GetFinalCustomVariables_Selects_Correct_Final_Variables()
        {
            var analyticsClient = new UrchinAnalyticsClient();
            analyticsClient.SessionCustomVariables[0] = new CustomVariable("session-one-name", "session-one-value");
            analyticsClient.SessionCustomVariables[2] = new CustomVariable("session-three-name", "session-three-value");
            analyticsClient.VisitorCustomVariables[0] = new CustomVariable("Visitor-one-name", "Visitor-one-value");
            analyticsClient.VisitorCustomVariables[1] = new CustomVariable("Visitor-two-name", "Visitor-two-value");

            var activityScopedVariables = new CustomVariableSlots();
            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 = analyticsClient.GetFinalCustomVariables(activityScopedVariables).ToDictionary(s => s.Slot);

            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);
        }
        public void CustomVariableSlots_Indexer_Sets_Slot()
        {
            var slots = new CustomVariableSlots();
            var slotOne = new CustomVariable("one", "1");

            slots[1] = slotOne;

            Assert.AreEqual(slotOne, slots[1]);
        }
        public void ScopedCustomVariable_Constructor_Sets_Properties()
        {
            var customVariable = new CustomVariable("name3", "value3");
            var scopedCustomVariableSlot = new ScopedCustomVariableSlot(CustomVariableScope.Session, customVariable , 3);

            Assert.AreEqual(CustomVariableScope.Session, scopedCustomVariableSlot.Scope);
            Assert.AreEqual(3, scopedCustomVariableSlot.Slot);
            Assert.AreEqual(customVariable, scopedCustomVariableSlot.Variable);
        }
        public void CustomVariableSlots_Indexer_Overwrites_Slot_When_Set_Again()
        {
            var slots = new CustomVariableSlots();
            var slotOneA = new CustomVariable("oneA", "1A");
            var slotOneB = new CustomVariable("oneB", "1B");

            slots[1] = slotOneA;
            slots[1] = slotOneB;

            Assert.AreEqual(1, slots.AllSlots.Count());
            Assert.AreEqual(slotOneB, slots[1]);
        }
        public void CustomVariableSlots_AllSlots_Identifies_By_Key()
        {
            var slots = new CustomVariableSlots();
            var slotOne = new CustomVariable("one", "1");
            var slotSix = new CustomVariable("six", "6");

            slots[1] = slotOne;
            slots[6] = slotSix;

            Assert.AreEqual(slotOne, slots.AllSlots.First(s => s.Key == 1).Value);
            Assert.AreEqual(slotSix, slots.AllSlots.First(s => s.Key == 6).Value);
        }
        public void CustomVariableSlots_Indexer_Sets_Multiple_Slot()
        {
            var slots = new CustomVariableSlots();
            var slotOne = new CustomVariable("one", "1");
            var slotNine = new CustomVariable("nine", "9");

            slots[1] = slotOne;
            slots[9] = slotNine;

            Assert.AreEqual(2, slots.AllSlots.Count());
            Assert.AreEqual(slotOne, slots[1]);
            Assert.AreEqual(slotNine, slots[9]);
        }
        public void CustomVariableSlots_Indexer_Unsets_Slot_When_Set_To_Null()
        {
            var slots = new CustomVariableSlots();
            var slotOne = new CustomVariable("one", "1");
            var slotNine = new CustomVariable("nine", "9");

            slots[1] = slotOne;
            slots[9] = slotNine;
            slots[9] = null;

            Assert.AreEqual(1, slots.AllSlots.Count());
            Assert.AreEqual(slotOne, slots[1]);
            Assert.IsNull(slots[9]);
        }