Ejemplo n.º 1
0
        public void TestJetCompactExceptionHandling()
        {
            var ex   = new ArgumentNullException();
            var test = new DatabaseFileTestHelper(EseInteropTestHelper.PathGetRandomFileName() + "-compactdatabase", true);

            test.TestCompactDatabaseCallbackExceptionHandling(ex);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new random directory in the current working directory. This
        /// should be used to ensure that each test runs in its own directory.
        /// </summary>
        /// <returns>The name of the directory.</returns>
        public static string CreateRandomDirectory()
        {
            string myDir = EseInteropTestHelper.PathGetRandomFileName() + @"\";

            EseInteropTestHelper.DirectoryCreateDirectory(myDir);
            return(myDir);
        }
Ejemplo n.º 3
0
        public void TestDeleteFileWithRetryWhenFileDoesNotExist()
        {
            string file = EseInteropTestHelper.PathGetRandomFileName();

            Assert.IsFalse(EseInteropTestHelper.FileExists(file));
            Cleanup.DeleteFileWithRetry(file);
        }
Ejemplo n.º 4
0
        public void TestDeleteDirectoryWithRetryWhenDirectoryDoesNotExist()
        {
            string directory = EseInteropTestHelper.PathGetRandomFileName();

            Assert.IsFalse(EseInteropTestHelper.DirectoryExists(directory));
            Cleanup.DeleteDirectoryWithRetry(directory);
        }
Ejemplo n.º 5
0
        public void TestJetGetDatabaseInfoWithUnicodePath()
        {
            if (!EsentVersion.SupportsUnicodePaths)
            {
                return;
            }

            var test = new DatabaseFileTestHelper(Path.Combine(this.directory, EseInteropTestHelper.PathGetRandomFileName()));

            test.TestGetDatabaseInfo();
        }
Ejemplo n.º 6
0
        public void AlternatePathRecoveryWithJetInit3()
        {
            if (!EsentVersion.SupportsUnicodePaths)
            {
                return;
            }

            var test = new DatabaseFileTestHelper(Path.Combine(this.directory, EseInteropTestHelper.PathGetRandomFileName()));

            test.TestJetInit3();
        }
Ejemplo n.º 7
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));
        }
Ejemplo n.º 8
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
        }
Ejemplo n.º 9
0
        public void TestJetCompact()
        {
            var test = new DatabaseFileTestHelper(EseInteropTestHelper.PathGetRandomFileName() + "-compactdatabase", true);

            test.TestCompactDatabase();
        }
Ejemplo n.º 10
0
 public void Setup()
 {
     this.directory = Path.Combine(EseInteropTestHelper.PathGetRandomFileName(), "字会意");
     Cleanup.DeleteDirectoryWithRetry(this.directory);
     this.database = Path.Combine(this.directory, "한글.edb");
 }
Ejemplo n.º 11
0
        public void CreateDatabaseAndSetSize()
        {
            var test = new DatabaseFileTestHelper(Path.Combine(EseInteropTestHelper.PathGetRandomFileName(), "database"));

            test.TestSetDatabaseSize();
        }