public void Initialize_WithCaseSensitiveFlag_AddsCaseSensitiveKeys()
        {
            DictionaryVariableSource dvs = new DictionaryVariableSource(false);
            dvs.Add("key1", "lowercasevalue");
            dvs.Add("KEY1", "uppercasevalue");

            Assert.AreEqual("lowercasevalue", dvs.ResolveVariable("key1"));
            Assert.AreEqual("uppercasevalue", dvs.ResolveVariable("KEY1"));
        }
        public void Initialize_WithCaseSensitiveFlag_AddsCaseSensitiveKeys()
        {
            DictionaryVariableSource dvs = new DictionaryVariableSource(false);

            dvs.Add("key1", "lowercasevalue");
            dvs.Add("KEY1", "uppercasevalue");

            Assert.AreEqual("lowercasevalue", dvs.ResolveVariable("key1"));
            Assert.AreEqual("uppercasevalue", dvs.ResolveVariable("KEY1"));
        }
        public void Initialize_WithEmptyConstructor_AddsCaseInsensitiveKeys()
        {
            DictionaryVariableSource dvs = new DictionaryVariableSource();

            dvs.Add("key1", "value1");
            dvs.Add("KEY2", "value2");

            Assert.AreEqual("value1", dvs.ResolveVariable("KEY1"));
            Assert.AreEqual("value2", dvs.ResolveVariable("key2"));
        }
        public void CanEnumerateDictionary()
        {
            DictionaryVariableSource dvs = new DictionaryVariableSource();

            dvs.Add("key1", "theValue");
            dvs.Add("key2", "theValue");

            foreach (KeyValuePair <string, string> dv in dvs)
            {
                Assert.AreEqual("theValue", dv.Value);
            }
        }
        public void CanEnumerateDictionary()
        {
            DictionaryVariableSource dvs = new DictionaryVariableSource();

            dvs.Add("key1", "theValue");
            dvs.Add("key2", "theValue");

            foreach (DictionaryEntry dv in dvs)
            {
                Assert.AreEqual("theValue", dv.Value);
            }
        }
        public void CanResolveVariable_RespectsCaseSensitivity()
        {
            DictionaryVariableSource caseSensitive = new DictionaryVariableSource(false);
            caseSensitive.Add("KEY1", "value1");

            Assert.False(caseSensitive.CanResolveVariable("key1"));
        }
        public void CanResolveVariable_RespectsCaseSensitivity()
        {
            DictionaryVariableSource caseSensitive = new DictionaryVariableSource(false);

            caseSensitive.Add("KEY1", "value1");

            Assert.False(caseSensitive.CanResolveVariable("key1"));
        }
        public void Requesting_KeyNotFound_ThrowsException()
        {
            const string THE_KEY = "key-found";

            DictionaryVariableSource dvs = new DictionaryVariableSource();

            dvs.Add(THE_KEY, "value-found");

            try
            {
                dvs.ResolveVariable("not" + THE_KEY);
                Assert.Fail("Expected ArgumentException not thrown.");
            }
            catch (ArgumentException)
            {
            }
        }
        public void Requesting_KeyNotFound_ThrowsException()
        {
            const string THE_KEY = "key-found";

            DictionaryVariableSource dvs = new DictionaryVariableSource();
            dvs.Add(THE_KEY, "value-found");

            try
            {
                dvs.ResolveVariable("not" + THE_KEY);
                Assert.Fail("Expected ArgumentException not thrown.");
            }
            catch (ArgumentException)
            {
            }
        }
        public void Initialize_WithEmptyConstructor_AddsCaseInsensitiveKeys()
        {
            DictionaryVariableSource dvs = new DictionaryVariableSource();
            dvs.Add("key1", "value1");
            dvs.Add("KEY2", "value2");

            Assert.AreEqual("value1", dvs.ResolveVariable("KEY1"));
            Assert.AreEqual("value2", dvs.ResolveVariable("key2"));
        }