public void TestBackupCreate() { WriteTestConfig("nobackup", false); Assert.IsTrue(File.Exists("nobackup")); Assert.IsFalse(File.Exists(UserConfig.GetBackupFile("nobackup"))); WriteTestConfig("withbackup", true); Assert.IsTrue(File.Exists("withbackup")); Assert.IsTrue(File.Exists(UserConfig.GetBackupFile("withbackup"))); }
public static void ResetConfig() { try{ File.Delete(ConfigFilePath); File.Delete(UserConfig.GetBackupFile(ConfigFilePath)); }catch (Exception e) { Reporter.HandleException("Configuration Reset Error", "Could not delete configuration files to reset the settings.", true, e); return; } ReloadConfig(); }
public void TestBackupRestore() { WriteTestConfig("gone", true); Assert.IsTrue(File.Exists("gone")); Assert.IsTrue(File.Exists(UserConfig.GetBackupFile("gone"))); File.Delete("gone"); Assert.IsTrue(CheckTestConfig("gone")); WriteTestConfig("corrupted", true); Assert.IsTrue(File.Exists("corrupted")); Assert.IsTrue(File.Exists(UserConfig.GetBackupFile("corrupted"))); File.WriteAllText("corrupted", "oh no corrupt"); Assert.IsTrue(CheckTestConfig("corrupted")); }
public void TestBackupName() { Assert.AreEqual("name.bak", UserConfig.GetBackupFile("name")); Assert.AreEqual("name.cfg.bak", UserConfig.GetBackupFile("name.cfg")); Assert.AreEqual("name.bak.bak", UserConfig.GetBackupFile("name.bak")); }