public void SetConfigVariable_NoConfigFile_CreatesFileAndVariable() { IStorage storage = new DiskStorage (NOTE_FOLDER_TEMP); string config_name = "config.xml"; string config_path = Path.Combine (NOTE_FOLDER_TEMP, config_name); System.IO.File.Delete (config_path); //Make sure it doesn't exist from before storage.SetConfigVariable ("testvar", "testval"); Assert.IsTrue (System.IO.File.Exists (config_path)); XDocument config = XDocument.Load (config_path); Assert.AreEqual ("testval", config.Root.Element ("testvar").Value); System.IO.File.Delete (config_path); //Clear up test for next time }
public void SetConfigVariable_ConfigFileExists_UpdatesVariable() { IStorage storage = new DiskStorage (NOTE_FOLDER_PROPER_NOTES); string config_name = "config.xml"; string config_path = Path.Combine (NOTE_FOLDER_PROPER_NOTES, config_name); storage.SetConfigVariable ("testvar", "testval2"); XDocument config = XDocument.Load (config_path); Assert.AreEqual ("testval2", config.Root.Element ("testvar").Value); config.Root.Element ("testvar").Value = "testval"; //Reset config.Save (config_path); }