/// <summary> /// /// </summary> /// <param name="defaultConfigFileExtension"></param> /// <param name="globalSectionName"></param> /// <param name="environmentVariableName"></param> /// <param name="defaultEnvironment"></param> public static void Initialize(string defaultConfigFileExtension = ".ini", string globalSectionName = "Global", string environmentVariableName = "Environment", string defaultEnvironment = "dev") { DefaultConfigFileExtension = defaultConfigFileExtension; GlobalSectionName = globalSectionName; EnvironmentVariableName = environmentVariableName; DefaultEnvironment = defaultEnvironment; ConfigurationSource = new InMemoryConfigurationSource(); }
public void GetSettingObjectTest() { var obj = new object(); var source = new InMemoryConfigurationSource <object>(obj); var settingObject = source.GetSettingObject(); Assert.Same(obj, settingObject); }
public void CtorTest() { Assert.Throws <ArgumentNullException>(() => new InMemoryConfigurationSource <object>(null)); Assert.Throws <ArgumentNullException>(() => new InMemoryConfigurationSource <object>(new object(), null)); var obj = new object(); var source = new InMemoryConfigurationSource <object>(obj); Assert.NotNull(source); }
public void GetDefaultSettingObjectTestWithDefaultCtor() { var obj = new TestSetting { Text = "Test" }; var source = new InMemoryConfigurationSource <TestSetting>(obj); var settingObject = source.GetDefaultSettingObject() as TestSetting; Assert.NotNull(settingObject); Assert.Equal("DefaultCtorText", settingObject.Text); }