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)); }
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)); }