public void FromFilesTest() { var fileSystem = new MockFileSystemEx(); fileSystem.AddFile(@"c:\temp\data0.config", new MockFileData("{\"Text\":\"DemoDataValue0\"}")); fileSystem.AddFile(@"c:\temp\data1.config", new MockFileData("{\"Text\":\"DemoDataValue1\"}")); fileSystem.Install(); var sources = JsonConfigurationSource <DemoSetting> .FromFiles(new[] { @"c:\temp\data0.config", @"c:\temp\data1.config" }).ToArray(); Assert.Equal(2, sources.Length); Assert.Contains("DemoDataValue0", sources.Select(source => (source.GetSettingObject() as DemoSetting)?.Text)); Assert.Contains("DemoDataValue1", sources.Select(source => (source.GetSettingObject() as DemoSetting)?.Text)); }
protected virtual IEnumerable <IConfigurationSource <T> > GetSources(string path, string fileSearchPattern) { return(JsonConfigurationSource <T> .FromFiles( FileSys.Directory.EnumerateFiles(path, fileSearchPattern))); }