public void Config_validation_exception_contains_missing_values_when_server_and_cache_config_is_invalid()
        {
            ConfigRoot configFromMockCache = MockHabitatServer.GetConfigRoot(TestComponentName);

            configFromMockCache.Data.Children[0].Value = "fromcache";
            configFromMockCache.Data.Children.Add(new ConfigNode {
                Name = "N4", Value = "V4"
            });
            CreateMockDurableCacheEntry(configFromMockCache);

            var testFactory = new ConfigProviderFactory(TestAssemblyName, _mockConfigServiceHttpClient, _mockFileSystem.Object);
            var validators  = new Dictionary <string, Func <string, bool> > {
                { "foo.N1", x => true }, { "foo.N2", x => true }, { "foo.N3", x => true }, { "foo.N4", x => true }
            };

            IConfigProvider configProvider = testFactory.Create(TestComponentName, validators);

            try
            {
                configProvider.GetAndValidateConfiguration();
                Assert.Fail("Invalid configuration passed validation");
            }
            catch (UnableToAccessConfigurationException e)
            {
                Assert.IsInstanceOfType(e.InnerException, typeof(ConfigValidationException), "Expected a ConfigValidationException to be thrown");
                ConfigValidationException configValidationEx = (ConfigValidationException)e.InnerException;
                Assert.IsTrue(Regex.IsMatch(configValidationEx.Message, "foo.N3, foo.N4"), "Missing invalid parameters from validation error message");
            }
        }
        public void Config_validation_exception_contains_missing_values_when_server_config_is_invalid_and_cache_is_empty()
        {
            var testFactory = new ConfigProviderFactory(TestAssemblyName, _mockConfigServiceHttpClient, _mockFileSystem.Object);
            var validators  = new Dictionary <string, Func <string, bool> > {
                { "foo.N1", x => true }, { "foo.N2", x => true }, { "foo.N3", x => true }
            };

            IConfigProvider configProvider = testFactory.Create(TestComponentName, validators);

            try
            {
                configProvider.GetAndValidateConfiguration();
                Assert.Fail("Invalid configuration passed validation");
            }
            catch (UnableToAccessConfigurationException e)
            {
                Assert.IsInstanceOfType(e.InnerException, typeof(ConfigValidationException), "Expected a ConfigValidationException to be thrown");
                ConfigValidationException configValidationEx = (ConfigValidationException)e.InnerException;
                Assert.IsTrue(Regex.IsMatch(configValidationEx.Message, "foo.N3"), "Missing invalid parameters from validation error message");
            }
        }