Exemplo n.º 1
0
 /// <summary>
 /// 测试线程的运行函数
 /// </summary>
 protected virtual void RunningThreadBody()
 {
     while (true)
     {
         // 获取要运行的测试,没有时退出循环
         string assemblyToRun = null;
         lock (RunningThreadLock) {
             lock (InformationsLock) {
                 var infoToRun = Informations.FirstOrDefault(info =>
                                                             info.State == AssemblyTestState.WaitingToRun);
                 if (infoToRun == null)
                 {
                     RunningThread = null;
                     return;
                 }
                 assemblyToRun = infoToRun.AssemblyName;
             }
         }
         // 运行测试
         var testManager  = Application.Ioc.Resolve <TestManager>();
         var assemblies   = testManager.GetAssembliesForTest();
         var assembly     = assemblies.First(a => a.GetName().Name == assemblyToRun);
         var eventHandler = new TestWebEventHandler();
         testManager.RunAssemblyTest(assembly, eventHandler);
     }
 }