Esempio n. 1
0
        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")));
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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"));
        }
Esempio n. 4
0
 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"));
 }