public void GetSettingObjectTestThrowException()
        {
            var source = new JsonConfigurationSource <DemoSetting>(@"c:\temp\data1234.config");

            var ex = Assert.Throws <ConfigurationFileSourceException>(() => source.GetSettingObject());

            Assert.Equal(@"c:\temp\data1234.config", ex.FileName);
            Assert.Same(source, ex.ConfigurationSource);
        }
        public void GetSettingObjectTest()
        {
            InstallDemoFileSys();

            var source = new JsonConfigurationSource <DemoSetting>(@"c:\temp\data.config");

            var settingObject = source.GetSettingObject() as DemoSetting;

            Assert.Equal("DemoDataValue", settingObject?.Text);
        }
        public void GetDefaultSettingObjectTest()
        {
            InstallDemoFileSys();

            var defaultObj = new DemoSetting {
                Text = "Test"
            };

            var source = new JsonConfigurationSource <DemoSetting>(@"c:\temp\data.config", () => defaultObj);

            var defaultSettingObject = source.GetDefaultSettingObject() as DemoSetting;
            var settingObject        = source.GetSettingObject() as DemoSetting;

            Assert.Equal("Test", defaultSettingObject?.Text);
            Assert.Equal("DemoDataValue", settingObject?.Text);
        }