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" }); }
public void ShouldNotThrowWhenClearConfigNeverSet() { string key = "DisableSomething"; var config = new SimpleTypedConfig <bool>(key, "{help message}", false); IConfigManager icm = GetConfigManager(config); icm.ClearConfig(key, ConfigScope.CurrentUser); }
public void CannotClearUnknownConfig() { IConfigManager configurationManager = GetConfigManager(); Assert.Throws <AzPSArgumentException>(() => { configurationManager.ClearConfig(new ClearConfigOptions("NeverRegistered", ConfigScope.CurrentUser)); }); }
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)); }
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)); }