public void Configure_and_load_settings() { var reader = new MongoDbReaderBuilder() .AddSetting("setting1", "value1") .AddSetting("setting2", "value2") .Build(); var configurationBuilder = new ConfigurationBuilder(); configurationBuilder.AddMongoDb(reader); var config = configurationBuilder.Build(); Assert.Equal("value1", config["setting1"]); Assert.Equal("value2", config["setting2"]); }
public void Load_should_set_data() { var reader = new MongoDbReaderBuilder() .AddSetting("setting1", "value1") .AddSetting("setting2", "value2") .Build(); var provider = new MongoDbConfigurationProvider(reader, "settings"); provider.Load(); Assert.True(provider.TryGet("setting1", out var value1)); Assert.True(provider.TryGet("setting2", out var value2)); Assert.False(provider.TryGet("setting3", out var value3)); Assert.Equal("value1", value1); Assert.Equal("value2", value2); Assert.True(provider.TryGet("SeTTing1", out value1)); Assert.Equal("value1", value1); }