예제 #1
0
        public void ShouldNotThrowToClearConfigNeverSet()
        {
            string         key1    = "key1";
            var            config1 = new SimpleTypedConfig <bool>(key1, "{help message}", false);
            string         key2    = "key2";
            var            config2 = new SimpleTypedConfig <bool>(key2, "{help message}", false);
            IConfigManager icm     = GetConfigManager(config1, config2);

            icm.ClearConfig(key1, ConfigScope.CurrentUser);
            icm.ClearConfig(key2, ConfigScope.Process);
            icm.ClearConfig(null, ConfigScope.CurrentUser);
            icm.ClearConfig(null, ConfigScope.Process);
            icm.ClearConfig(new ClearConfigOptions(null, ConfigScope.CurrentUser)
            {
                AppliesTo = null
            });
            icm.ClearConfig(new ClearConfigOptions(null, ConfigScope.Process)
            {
                AppliesTo = null
            });
            icm.ClearConfig(new ClearConfigOptions(null, ConfigScope.CurrentUser)
            {
                AppliesTo = "Az.Accounts"
            });
            icm.ClearConfig(new ClearConfigOptions(null, ConfigScope.Process)
            {
                AppliesTo = "Az.Accounts"
            });
        }
예제 #2
0
        public void ShouldNotThrowWhenClearConfigNeverSet()
        {
            string         key    = "DisableSomething";
            var            config = new SimpleTypedConfig <bool>(key, "{help message}", false);
            IConfigManager icm    = GetConfigManager(config);

            icm.ClearConfig(key, ConfigScope.CurrentUser);
        }
예제 #3
0
        public void CannotClearUnknownConfig()
        {
            IConfigManager configurationManager = GetConfigManager();

            Assert.Throws <AzPSArgumentException>(() =>
            {
                configurationManager.ClearConfig(new ClearConfigOptions("NeverRegistered", ConfigScope.CurrentUser));
            });
        }
예제 #4
0
        public void CanClearSingleConfig()
        {
            string         key = "FalseByDefault";
            IConfigManager icm = GetConfigManager(new SimpleTypedConfig <bool>(key, "{help message}", false));

            Assert.False(icm.GetConfigValue <bool>(key));

            icm.UpdateConfig(new UpdateConfigOptions(key, true, ConfigScope.Process));
            Assert.True(icm.GetConfigValue <bool>(key));

            icm.ClearConfig(new ClearConfigOptions(key, ConfigScope.Process));
            Assert.False(icm.GetConfigValue <bool>(key));
        }
예제 #5
0
        public void CanClearSingleConfigInJson()
        {
            IConfigManager icm = GetConfigManager();
            string         key = "DisableSomething";

            icm.RegisterConfig(new SimpleTypedConfig <bool>(key, "{help message}", false));
            icm.BuildConfig();

            Assert.False(icm.GetConfigValue <bool>(key));

            icm.UpdateConfig(new UpdateConfigOptions(key, true, ConfigScope.CurrentUser));
            Assert.True(icm.GetConfigValue <bool>(key));

            icm.ClearConfig(new ClearConfigOptions(key, ConfigScope.CurrentUser));
            Assert.False(icm.GetConfigValue <bool>(key));
        }