public void UpdateSettingsFromDiscovery_UpdatesSettingsCorrectly() { var values = new Dictionary <string, string>() { { "spring:cloud:config:discovery:enabled", "True" } }; IConfiguration configuration = new ConfigurationBuilder() .AddInMemoryCollection(values) .Build(); var settings = new ConfigServerClientSettings { Uri = "http://localhost:8888/", Name = "foo", Environment = "development" }; ConfigServerConfigurationSource source = new ConfigServerConfigurationSource(settings, configuration); var provider = new ConfigServerConfigurationProvider(source); provider.UpdateSettingsFromDiscovery(new List <IServiceInstance>(), settings); Assert.Null(settings.Username); Assert.Null(settings.Password); Assert.Equal("http://localhost:8888/", settings.Uri); var metadata1 = new Dictionary <string, string>() { { "password", "firstPassword" } }; var metadata2 = new Dictionary <string, string>() { { "password", "secondPassword" }, { "user", "secondUser" }, { "configPath", "configPath" } }; var instances = new List <IServiceInstance>() { new TestServiceInfo(new Uri("http://foo.bar:8888/"), metadata1), new TestServiceInfo(new Uri("http://foo.bar.baz:9999/"), metadata2) }; provider.UpdateSettingsFromDiscovery(instances, settings); Assert.Equal("secondUser", settings.Username); Assert.Equal("secondPassword", settings.Password); Assert.Equal("http://foo.bar:8888/,http://foo.bar.baz:9999/configPath", settings.Uri); }