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

            var allValues = builder.GetAllValues("");

            // Has all the test values
            Assert.Equal(CommonKeyValuePairs["TestKey"], GetValueFromCollection(allValues, "TestKey"));
            Assert.Equal(CommonKeyValuePairs["Prefix_TestKey"], GetValueFromCollection(allValues, "Prefix_TestKey"));
        }
        public static void GetAllValues_Prefix1(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            attrs = attrs ?? new NameValueCollection();
            attrs.Add("prefix", "Prefix_");
            builder.Initialize(name, attrs);

            var allValues = builder.GetAllValues("Prefix_");

            // Has all the test values
            Assert.Equal(CommonKeyValuePairs["Prefix_TestKey"], GetValueFromCollection(allValues, "Prefix_TestKey"));

            // Does not contain what is not there.
            Assert.Null(GetValueFromCollection(allValues, "TestKey"));
        }
        // ======================================================================
        //   GetAllValues
        //      - Has existing values
        //      - Does not contain what is not there.
        // ======================================================================
        public static void GetAllValues(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            builder.Initialize(name, attrs ?? new NameValueCollection());

            var allValues = builder.GetAllValues("");

            // Has all the test values
            Assert.Equal(CommonKeyValuePairs["TestKey"], GetValueFromCollection(allValues, "TestKey"));
            Assert.Equal(CommonKeyValuePairs["Prefix_TestKey"], GetValueFromCollection(allValues, "Prefix_TestKey"));

            // Does not contain what is not there.
            // This would be a super wierd one to fail.
            Assert.Null(GetValueFromCollection(allValues, "This_Value_Does_Not_Exist"));
        }
        public static void GetAllValues_Prefix2(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            attrs = attrs ?? new NameValueCollection();
            attrs.Add("prefix", "Prefix_");
            attrs.Add("stripPrefix", "true");
            builder.Initialize(name, attrs);

            // stripPrefix does not affect GetAllValues, as the KVCB base handles all prefix-stripping tasks.
            var allValues = builder.GetAllValues("Prefix_");

            // Has all the test values
            Assert.Equal(CommonKeyValuePairs["Prefix_TestKey"], GetValueFromCollection(allValues, "Prefix_TestKey"));

            // Does not contain what is not there.
            Assert.Null(GetValueFromCollection(allValues, "TestKey"));
        }
Beispiel #5
0
        public static void GetAllValues_Prefix1(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            attrs = attrs ?? new NameValueCollection();
            attrs.Add("prefix", "Prefix_");
            builder.Initialize(name, attrs);

            var allValues = builder.GetAllValues("Prefix_");

            // Has all the test values
            Assert.AreEqual(CommonKeyValuePairs["Prefix_TestKey"], GetValueFromCollection(allValues, "Prefix_TestKey"),
                            $"GetAllValues_Prefix1[{name}]: Failed to retrieve first existing value.");

            // Does not contain what is not there.
            Assert.IsNull(GetValueFromCollection(allValues, "TestKey"),
                          $"GetAllValues_Prefix1[{name}]: Returned non-null value for a key that doesn't exist.");
        }
Beispiel #6
0
        // ======================================================================
        //   GetAllValues
        //      - Has existing values
        //      - Does not contain what is not there.
        // ======================================================================
        public static void GetAllValues(KeyValueConfigBuilder builder, string name, NameValueCollection attrs = null)
        {
            builder.Initialize(name, attrs ?? new NameValueCollection());

            var allValues = builder.GetAllValues("");

            // Has all the test values
            Assert.AreEqual(CommonKeyValuePairs["TestKey"], GetValueFromCollection(allValues, "TestKey"),
                            $"GetAllValues[{name}]: Failed to retrieve first existing value.");
            Assert.AreEqual(CommonKeyValuePairs["Prefix_TestKey"], GetValueFromCollection(allValues, "Prefix_TestKey"),
                            $"GetAllValues[{name}]: Failed to retrieve second existing value.");

            // Does not contain what is not there.
            // This would be a super wierd one to fail.
            Assert.IsNull(GetValueFromCollection(allValues, "This_Value_Does_Not_Exist"),
                          $"GetAllValues[{name}]: Returned non-null value for a key that doesn't exist.");
        }