Exemple #1
0
        public void LoadJson()
        {
            var loader = new SettingsLoader();

            loader.XmlFileBySection();
            loader.JsonFileBySection();
            loader.JsonFileByExtension();

            loader.Loaded += (s, e) =>
            {
                Console.WriteLine("Loaded: {0} ({1})", e.Settings.GetType(), e.Settings.Identity);
            };

            var settings = loader
                           .LoadSettings(new XmlFileSettings("Examples/AppDirectory/mainJson.config".ResolveTestPath()))
                           .Joined
                           .ToAppSettings();

            var addCfg = settings.TryGet <ExampleCombineConfig>("AdditionalConfig");

            Assert.IsNotNull(addCfg);
            Assert.AreEqual("InAppDirectory_json", addCfg.F);
        }