示例#1
0
        public void IsDiscoveryFirstEnabled_ReturnsExpected()
        {
            ConfigServerClientSettings settings = new ConfigServerClientSettings
            {
                Uri              = "http://localhost:8888/",
                Name             = "foo",
                Environment      = "development",
                DiscoveryEnabled = true
            };

            ConfigServerConfigurationProvider provider = new ConfigServerConfigurationProvider(settings);

            Assert.True(provider.IsDiscoveryFirstEnabled());

            var values = new Dictionary <string, string>()
            {
                { "spring:cloud:config:discovery:enabled", "True" }
            };

            IConfiguration configuration = new ConfigurationBuilder()
                                           .AddInMemoryCollection(values)
                                           .Build();

            settings = new ConfigServerClientSettings
            {
                Uri         = "http://localhost:8888/",
                Name        = "foo",
                Environment = "development"
            };
            ConfigServerConfigurationSource source = new ConfigServerConfigurationSource(settings, configuration);

            provider = new ConfigServerConfigurationProvider(source);

            // Act and Assert
            Assert.True(provider.IsDiscoveryFirstEnabled());
        }