public void ConfigurationToAppConfigurator() { "原本在 IConfiguration 存放的内容,可以通过 AppConfigurator 创建出来的配置读取到".Test(() => { // Arrange const string key = "LindexiIsDoubi"; const string value = "doubi"; var memoryConfigurationSource = new MemoryConfigurationSource() { InitialData = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>(key, value) } }; IConfigurationProvider configurationProvider = new MemoryConfigurationProvider(memoryConfigurationSource); IConfiguration configuration = new ConfigurationRoot(new List <IConfigurationProvider>() { configurationProvider }); // Act var appConfigurator = configuration.ToAppConfigurator(); var configurationValue = appConfigurator.Default[key]; // Assert Assert.IsNotNull(configurationValue); Assert.AreEqual(value, configurationValue.ToString()); }); }