Пример #1
0
        public void ConfigStoreTestGet()
        {
            ConfigStore store = ConfigStore.CreateFromFile("config.ini", ENV_PREFIX);

            Assert.Equal("VALUE_01", store.Get <string>("CONFIG_WITH_NO_SECTION"));
            Assert.Equal("VALUE_03", store.Get <string>("SECTION1", "CONFIG_INSIDE_SECTION1"));
            Assert.Equal("VALUE_01", store.GetWithDefaultValue("CONFIG_WITH_NO_SECTION", "WRONG_VALUE"));
            Assert.Equal("VALUE_03", store.GetWithDefaultValue("SECTION1", "CONFIG_INSIDE_SECTION1", "WRONG_VALUE"));
            Assert.Equal("DEFAULT_VALUE", store.GetWithDefaultValue("WRONG_KEY", "DEFAULT_VALUE"));
            Assert.Equal("DEFAULT_VALUE", store.GetWithDefaultValue("WRONG_SECTION", "WRONG_KEY", "DEFAULT_VALUE"));
        }