public void AddPropertySource_ChangesDataDictionary()
        {
            // Arrange
            IHostingEnvironment          envir      = new HostingEnvironment();
            IDictionary <string, object> properties = new Dictionary <string, object>();

            properties["a.b.c.d"] = "value1";
            properties["a"]       = "value2";
            properties["b"]       = 10;
            PropertySource source = new PropertySource("test", properties);

            source.Name = "test";
            ConfigServerConfigurationProvider provider = new ConfigServerConfigurationProvider(new ConfigServerClientSettings(), envir);

            // Act and Assert
            provider.AddPropertySource(source);

            string value;

            Assert.True(provider.TryGet("a:b:c:d", out value));
            Assert.Equal("value1", value);
            Assert.True(provider.TryGet("a", out value));
            Assert.Equal("value2", value);
            Assert.True(provider.TryGet("b", out value));
            Assert.Equal("10", value);
        }
Ejemplo n.º 2
0
        public void AddPropertySource_ChangesDataDictionary()
        {
            // Arrange
            IDictionary <string, object> properties = new Dictionary <string, object>
            {
                ["a.b.c.d"] = "value1",
                ["a"]       = "value2",
                ["b"]       = 10
            };
            PropertySource source = new PropertySource("test", properties)
            {
                Name = "test"
            };
            ConfigServerConfigurationProvider provider = new ConfigServerConfigurationProvider(new ConfigServerClientSettings());

            // Act and Assert
            provider.AddPropertySource(source);

            Assert.True(provider.TryGet("a:b:c:d", out string value));
            Assert.Equal("value1", value);
            Assert.True(provider.TryGet("a", out value));
            Assert.Equal("value2", value);
            Assert.True(provider.TryGet("b", out value));
            Assert.Equal("10", value);
        }
        public void AddPropertySource_ChangesDataDictionary()
        {
            // Arrange
            IDictionary<string,object> properties = new Dictionary<string, object>();
            properties["a.b.c.d"] = "value1";
            properties["a"] = "value2";
            properties["b"] = 10;
            PropertySource source = new PropertySource("test", properties );
            source.Name = "test";
            ConfigServerConfigurationProvider provider = new ConfigServerConfigurationProvider();

            // Act and Assert
            provider.AddPropertySource(source);

            string value;
            Assert.True(provider.TryGet("a:b:c:d", out value));
            Assert.Equal("value1", value);
            Assert.True(provider.TryGet("a", out value));
            Assert.Equal("value2", value);
            Assert.True(provider.TryGet("b", out value));
            Assert.Equal("10", value);

        }