public void FinalizeContext()
 {
     if (this._asyncThread != null)
     {
         this._asyncThread.Join();
     }
     this._asyncThread          = (Thread)null;
     this._asyncRunner          = (AsyncRunner)null;
     this._awaitableAsyncRunner = (AwaitableAsyncRunner)null;
     this._asyncTask            = (Task)null;
 }
 public void RunTestAux(string commandLine)
 {
     TestCommonBase.BaseInstance.IsTestEnabled = true;
     MBDebug.TestModeEnabled = true;
     string[] strArray = commandLine.Split(' ');
     if (strArray.Length < 2)
     {
         MBDebug.ShowWarning("RunTextAux invalid commandLine!");
     }
     else
     {
         string asyncRunner = strArray[1];
         if (asyncRunner == "OpenSceneOnStartup")
         {
             TestCommonBase.BaseInstance.SceneNameToOpenOnStartup = strArray[2];
         }
         for (int index = 3; index < strArray.Length; ++index)
         {
             int result;
             int.TryParse(strArray[index], out result);
             TestCommonBase.BaseInstance.TestRandomSeed = result;
         }
         MBDebug.Print(nameof(commandLine) + commandLine);
         MBDebug.Print("p" + strArray.ToString());
         MBDebug.Print("Looking for test " + asyncRunner, color: Debug.DebugColor.Yellow);
         ConstructorInfo runnerConstructor = this.GetAsyncRunnerConstructor(asyncRunner);
         object          obj = (object)null;
         if (runnerConstructor != (ConstructorInfo)null)
         {
             obj = runnerConstructor.Invoke(new object[0]);
         }
         this._asyncRunner          = obj as AsyncRunner;
         this._awaitableAsyncRunner = obj as AwaitableAsyncRunner;
         if (this._asyncRunner != null)
         {
             this._asyncThread      = new Thread((ThreadStart)(() => this._asyncRunner.Run()));
             this._asyncThread.Name = "ManagedAsyncThread";
             this._asyncThread.Start();
         }
         if (this._awaitableAsyncRunner == null)
         {
             return;
         }
         this._asyncTask = this._awaitableAsyncRunner.RunAsync();
     }
 }