public static void GetValue_Prefix3(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            attrs = attrs ?? new NameValueCollection();
            attrs.Add("stripPrefix", "true");
            builder.Initialize(name, attrs);

            // even if there is no prefix given.
            Assert.Equal(CommonKeyValuePairs["TestKey"], builder.GetValue("TestKey"));
            Assert.Equal(CommonKeyValuePairs["Prefix_TestKey"], builder.GetValue("Prefix_TestKey"));
        }
        public static void GetValue_Prefix1(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            attrs = attrs ?? new NameValueCollection();
            attrs.Add("prefix", "Prefix_");
            builder.Initialize(name, attrs);

            // Does not care about prefix...
            Assert.Equal(CommonKeyValuePairs["TestKey"], builder.GetValue("TestKey"));
            Assert.Equal(CommonKeyValuePairs["Prefix_TestKey"], builder.GetValue("Prefix_TestKey"));
        }
Example #3
0
        public static void GetValue_Prefix3(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            attrs = attrs ?? new NameValueCollection();
            attrs.Add("stripPrefix", "true");
            builder.Initialize(name, attrs);

            // even if there is no prefix given.
            Assert.AreEqual(CommonKeyValuePairs["TestKey"], builder.GetValue("TestKey"),
                            $"GetValue_Prefix3[{name}]: Failed to retrieve dirst existing value.");
            Assert.AreEqual(CommonKeyValuePairs["Prefix_TestKey"], builder.GetValue("Prefix_TestKey"),
                            $"GetValue_Prefix3[{name}]: Failed to retrieve second existing value.");
        }
Example #4
0
        public static void GetValue_Prefix1(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            attrs = attrs ?? new NameValueCollection();
            attrs.Add("prefix", "Prefix_");
            builder.Initialize(name, attrs);

            // Does not care about prefix...
            Assert.AreEqual(CommonKeyValuePairs["TestKey"], builder.GetValue("TestKey"),
                            $"GetValue_Prefix1[{name}]: Failed to retrieve first existing value.");
            Assert.AreEqual(CommonKeyValuePairs["Prefix_TestKey"], builder.GetValue("Prefix_TestKey"),
                            $"GetValue_Prefix1[{name}]: Failed to retrieve second existing value.");
        }
        // ======================================================================
        //   GetValue
        //      - Gets what is there.
        //      - Does not get what is not there.
        //      - Is NOT case-sensitive.
        //      - Does not care about prefix or stripPrefix.
        // ======================================================================

        public static void GetValue(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            builder.Initialize(name, attrs ?? new NameValueCollection());

            // Gets what is there.
            Assert.Equal(CommonKeyValuePairs["TestKey"], builder.GetValue("TestKey"));

            // Does not get what is not there.
            Assert.Null(builder.GetValue("This_Value_Does_Not_Exist"));

            // Is NOT case-sensitive.
            Assert.Equal(CommonKeyValuePairs["TestKey"], builder.GetValue("testkey"));
        }
Example #6
0
        // ======================================================================
        //   GetValue
        //      - Gets what is there.
        //      - Does not get what is not there.
        //      - Is NOT case-sensitive.
        //      - Does not care about prefix or stripPrefix.
        // ======================================================================

        public static void GetValue(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            builder.Initialize(name, attrs ?? new NameValueCollection());

            // Gets what is there.
            Assert.AreEqual(CommonKeyValuePairs["TestKey"], builder.GetValue("TestKey"),
                            $"GetValue[{name}]: Failed to retrieve existing value.");

            // Does not get what is not there.
            Assert.IsNull(builder.GetValue("This_Value_Does_Not_Exist"),
                          $"GetValue[{name}]: Returned non-null value for a key that doesn't exist.");

            // Is NOT case-sensitive.
            Assert.AreEqual(CommonKeyValuePairs["TestKey"], builder.GetValue("testkey"),
                            $"GetValue[{name}]: Failed to retrieve existing value for case-insensitive key.");
        }