public void SetNullAndSaveDoesNothingWhenConfigEmpty() { StringKeeper keeper = CreateStringKeeper(); keeper.Set(Key, null); keeper.Save(); System.Configuration.Configuration config = CreateConfig(); Assert.IsFalse(config.AppSettings.Settings.AllKeys.Any()); }
public void SetAndSaveSavesStringToConfig() { StringKeeper keeper = CreateStringKeeper(); keeper.Set(Key, Value); keeper.Save(); System.Configuration.Configuration config = CreateConfig(); Assert.IsTrue(config.AppSettings.Settings.AllKeys.Count() == 1); Assert.AreEqual(Value, config.AppSettings.Settings[ConfigKey].Value); }
public void SetNullAndSaveRemovesEntryFromConfig() { System.Configuration.Configuration config = CreateConfig(); config.AppSettings.Settings.Add(ConfigKey, Value); config.Save(); StringKeeper keeper = CreateStringKeeper(); keeper.Set(Key, null); keeper.Save(); config = CreateConfig(); Assert.IsFalse(config.AppSettings.Settings.AllKeys.Any()); }
public void SetAndSaveReplacesEntryInConfig() { const string value = "Value"; const string anotherValue = "Another value"; System.Configuration.Configuration config = CreateConfig(); config.AppSettings.Settings.Add(ConfigKey, value); config.Save(); StringKeeper keeper = CreateStringKeeper(); keeper.Set(Key, anotherValue); keeper.Save(); config = CreateConfig(); Assert.IsTrue(config.AppSettings.Settings.AllKeys.Count() == 1); Assert.AreEqual(anotherValue, config.AppSettings.Settings[ConfigKey].Value); }