Beispiel #1
0
        public void TestDeleteDirectoryWithRetryWhenDirectoryDoesNotExist()
        {
            string directory = EseInteropTestHelper.PathGetRandomFileName();

            Assert.IsFalse(EseInteropTestHelper.DirectoryExists(directory));
            Cleanup.DeleteDirectoryWithRetry(directory);
        }
Beispiel #2
0
 /// <summary>
 /// Delete a directory, retrying the operation if the delete fails.
 /// </summary>
 /// <param name="directory">
 /// The directory to delete.
 /// </param>
 public static void DeleteDirectoryWithRetry(string directory)
 {
     PerformActionWithRetry(
         () =>
     {
         if (EseInteropTestHelper.DirectoryExists(directory))
         {
             EseInteropTestHelper.DirectoryDelete(directory, true);
         }
     });
 }
Beispiel #3
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
        }