private TestRunResults[] runTests(ITestRunner testRunner, TestRunInfo[] runInfos, Action <AutoTest.TestRunners.Shared.Targeting.Platform, Version, Action <System.Diagnostics.ProcessStartInfo, bool> > processWrapper)
 {
     try
     {
         return(testRunner.RunTests(runInfos, processWrapper, () => { return _exit; }));
     }
     catch (Exception ex)
     {
         return(new TestRunResults[] { new TestRunResults("", testRunner.GetType().ToString(), false, TestRunner.Any, new TestResult[] { new TestResult(TestRunner.Any, TestRunStatus.Failed, "AutoTest.Net internal error", ex.ToString()) }) });
     }
 }
 private void reRunTests(ITestRunner runner, RunReport report, List<TestRunInfo> testRunInfos, Action<AutoTest.TestRunners.Shared.Targeting.Platform, Version, Action<System.Diagnostics.ProcessStartInfo, bool>> processWrapper)
 {
     var rerunInfos = new List<TestRunInfo>();
     foreach (var info in testRunInfos)
     {
         if (info.RerunAllTestWhenFinishedForAny())
             rerunInfos.Add(new TestRunInfo(info.Project, info.Assembly));
     }
     if (rerunInfos.Count > 0)
     {
         Debug.WriteDebug("Rerunning all tests for runner " + runner.GetType().ToString());
         var results = runner.RunTests(testRunInfos.ToArray(), processWrapper, () => { return _exit; });
         mergeReport(results, report, testRunInfos.ToArray());
     }
 }
        public void Run(ITest test)
        {
            var appDomain = AppDomain.CreateDomain("TestRunnerNew");

            appDomain.Load(new AssemblyName(runner.GetType().Assembly.FullName)); //TODO: move this to the TestCommand
            //appDomain.Load(test.TestAssembly.FullName);

            var callback = TestCommand.Create(runner, test);

            appDomain.DoCallBack(callback.Run);


            try
            {
                AppDomain.Unload(appDomain);// this causes crashes in character controllers?
            }
            catch (Exception unloadEx)
            {
                Console.WriteLine(unloadEx);
            }
        }
        private void runTest(ITestRunner runner, PreProcessedTesRuns preProcessed, RunReport report)
        {
            var testRunInfos = new List <TestRunInfo>();

            foreach (var runInfo in preProcessed.RunInfos)
            {
                if (_testAssemblyValidator.ShouldNotTestAssembly(runInfo.Assembly))
                {
                    return;
                }
                if (runner.CanHandleTestFor(runInfo.Assembly))
                {
                    testRunInfos.Add(runInfo.CloneToTestRunInfo());
                    _bus.Publish(new RunInformationMessage(InformationType.TestRun, "", runInfo.Assembly, runner.GetType()));
                }
            }
            if (testRunInfos.Count == 0)
            {
                return;
            }
            var results = runner.RunTests(testRunInfos.ToArray(), preProcessed.ProcessWrapper, () => { return(_exit); });

            if (_exit)
            {
                return;
            }
            mergeReport(results, report, testRunInfos.ToArray());
            reRunTests(runner, report, testRunInfos, preProcessed.ProcessWrapper);
        }