Exemple #1
0
        public void VerifyDeleteFileWithRetryRemovesFile()
        {
            // Create a random file
            string file = EseInteropTestHelper.PathGetRandomFileName();

            EseInteropTestHelper.FileWriteAllText(file, "hello");
            Assert.IsTrue(EseInteropTestHelper.FileExists(file));

            // Delete the file
            Cleanup.DeleteFileWithRetry(file);

            // The file should no longer exist
            Assert.IsFalse(EseInteropTestHelper.FileExists(file));
        }
Exemple #2
0
        public void VerifyDeleteDirectoryWithRetryRemovesDirectory()
        {
            // Create a random directory with a file in it
            string directory = EseInteropTestHelper.PathGetRandomFileName();

            EseInteropTestHelper.DirectoryCreateDirectory(directory);
            EseInteropTestHelper.FileWriteAllText(Path.Combine(directory, "foo.txt"), "hello");
            Assert.IsTrue(EseInteropTestHelper.DirectoryExists(directory));

            // Delete the directory
            Cleanup.DeleteDirectoryWithRetry(directory);

            // UNDONE: DeleteDirectoryWithRetry doesn't work with non-empty directories, and it just leaks space now!
#if !MANAGEDESENT_ON_WSA
            // The directory should no longer exist
            Assert.IsFalse(EseInteropTestHelper.DirectoryExists(directory));
#endif
        }