Esempio n. 1
0
        private void tidyTest()
        {
            SqlConnection.ClearAllPools();

            if (m_ErrorIndex != null)
            {
                m_ErrorIndex.Deactivate();
                try { m_ErrorIndex.DeleteIndex(); }
                catch {; }
                m_ErrorIndex.Dispose();
                SqlConnection.ClearAllPools();
                m_ErrorIndex = null;
            }

            String sourceDatabaseName = "MoveIndexTestDatabase1";
            String destDatabaseName   = "MoveIndexTestDatabase2";

            DbProviderFactory providerFactory = DbProviderFactories.GetFactory("System.Data.SqlClient");

            SqlCommands sqlCommands = new SqlCommands(providerFactory, s_MasterConnectionString, s_MasterConnectionString, 1);

            // Delete any remnants that may exist from a previous test.
            SqlConnection.ClearAllPools();
            try { sqlCommands.DeleteDatabase(sourceDatabaseName); }
            catch (System.Exception ex) { Console.WriteLine("Failed to delete: " + sourceDatabaseName + " " + ex.ToString()); };

            SqlConnection.ClearAllPools();
            try { sqlCommands.DeleteDatabase(destDatabaseName); }
            catch (System.Exception ex) { Console.WriteLine("Failed to delete: " + destDatabaseName + " " + ex.ToString()); };

            sqlCommands.Dispose();

            SqlConnection.ClearAllPools();

            if (Directory.Exists(m_TestFolder))
            {
                PathUtils.DeleteDirectory(m_TestFolder, true);
            }
            if (Directory.Exists(m_TestFolder2))
            {
                PathUtils.DeleteDirectory(m_TestFolder2, true);
            }
            if (Directory.Exists(m_TestFolder3))
            {
                PathUtils.DeleteDirectory(m_TestFolder3, true);
            }
        }