/// <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();
 }
Exemplo n.º 2
0
        public void GetSettingObjectTest()
        {
            var obj = new object();

            var source = new InMemoryConfigurationSource <object>(obj);

            var settingObject = source.GetSettingObject();

            Assert.Same(obj, settingObject);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }