Пример #1
0
        public void TestDeleteFiles()
        {
            string rootPath = Path.Combine(Path.GetTempPath(), "folder");

            if (Directory.Exists(rootPath))
            {
                Directory.Delete(rootPath, true);
            }

            Directory.CreateDirectory(rootPath);

            string path1 = Path.Combine(rootPath, "file1.txt");

            CFileUtils.Write(path1, "text");

            string path2 = Path.Combine(rootPath, "file2.txt");

            CFileUtils.Write(path2, "text");

            Assert.IsTrue(CFileUtils.FileExists(path1));
            Assert.IsTrue(CFileUtils.FileExists(path2));

            Assert.IsTrue(CFileUtils.Delete(path1));
            Assert.IsFalse(CFileUtils.FileExists(path1));
            Assert.IsFalse(CFileUtils.Delete(path1));

            Assert.IsTrue(CFileUtils.Delete(rootPath));
            Assert.IsFalse(CFileUtils.FileExists(rootPath));
            Assert.IsFalse(CFileUtils.Delete(rootPath));

            Assert.IsFalse(CFileUtils.FileExists(path2));
            Assert.IsFalse(CFileUtils.Delete(path2));
        }
Пример #2
0
 public static void DeleteConfigs()
 {
     CFileUtils.Delete(ConfigPath);
 }