internal static void InitiateTempDatabase(bool enforceRestart, bool mustRenew)
        {
            if (!IsTddExecutionMode())
            {
                return;
            }

            IsDatabaseBeingCreated = true;

            try
            {
                SqlConnection.ClearAllPools();

                AutomatedTask.DeleteExecutionStatusHistory();

                if (enforceRestart)
                {
                    TempDatabaseInitiated = null;
                }

                if (TempDatabaseInitiated.HasValue)
                {
                    return;
                }

                var generator = new TestDatabaseGenerator(isTempDatabaseOptional: true, mustRenew: mustRenew);

                TempDatabaseInitiated = generator.Process();

                Database.Refresh();

                SqlConnection.ClearAllPools();

                // new Action(() => Database.Find<IEmailQueueItem>()).Invoke(retries: 20, waitBeforeRetries: TimeSpan.FromSeconds(1));
            }
            finally
            {
                IsDatabaseBeingCreated = false;
            }
        }
Beispiel #2
0
        internal static void InitiateTempDatabase(bool enforceRestart, bool mustRenew)
        {
            if (!IsTddExecutionMode())
            {
                return;
            }

            IsDatabaseBeingCreated = true;

            try
            {
                SqlConnection.ClearAllPools();

                AutomatedTask.DeleteExecutionStatusHistory();

                if (enforceRestart)
                {
                    TempDatabaseInitiated = null;
                }

                if (TempDatabaseInitiated.HasValue)
                {
                    return;
                }

                var generator = new TestDatabaseGenerator(isTempDatabaseOptional: true, mustRenew: mustRenew);

                TempDatabaseInitiated = generator.Process();

                Database.Refresh();

                SqlConnection.ClearAllPools();
            }
            finally
            {
                IsDatabaseBeingCreated = false;
            }
        }