public void GetDefaultSettingObjectTestWithDefaultCtor() { InstallDemoFileSys(); var source = new JsonConfigurationSource <DemoSetting>(@"c:\temp\data.config"); var defaultSettingObject = source.GetDefaultSettingObject() as DemoSetting; var settingObject = source.GetSettingObject() as DemoSetting; Assert.Equal("DemoDataValue", settingObject?.Text); Assert.NotNull(defaultSettingObject); Assert.Null(defaultSettingObject.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); }