예제 #1
0
        public void TestDeleteFileOrDirectoryFile()
        {
            string tempfile = Path.Combine(tempFolder, "temp.txt");

            File.OpenWrite(tempfile).Close();
            Assert.IsTrue(File.Exists(tempfile));
            Utils.DeleteFileOrDirectory(tempfile);
            Assert.IsFalse(File.Exists(tempfile));
        }
예제 #2
0
        public void TestDeleteFileOrDirectoryDirectory()
        {
            // create a temp directory with some files in it
            string tempDir = CreateTempDirWithFiles();

            // Ensure the dir exists
            Assert.IsTrue(Directory.Exists(tempDir));

            Utils.DeleteFileOrDirectory(tempDir);

            // Ensure the file was deleted
            Assert.IsFalse(Directory.Exists(tempDir));
        }