public static void Run([QueueTrigger("queue-with-tests", Connection = "storage_Conn")] TestTypeInfo myQueueItem, [Table(tableName: "TestResults", Connection = "storage_Conn")] ICollector <TestResult> outputTable, TraceWriter log)
        {
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            ManualResetEvent executionManualResetEvent = new ManualResetEvent(false);
            var resultProxy = new ResultProxy(outputTable, myQueueItem);
            var runner      = AssemblyRunner.WithAppDomain(myQueueItem.DllPath);

            runner.OnTestFailed       += resultProxy.OnTestFailed;
            runner.OnTestPassed       += resultProxy.OnTestPassed;
            runner.OnTestSkipped      += resultProxy.OnTestSkipped;
            runner.OnExecutionComplete = info => { executionManualResetEvent.Set(); };
            runner.OnErrorMessage      = info => { executionManualResetEvent.Set(); };
            runner.Start(myQueueItem.TypeName);

            executionManualResetEvent.WaitOne();
            executionManualResetEvent.Dispose();
            while (runner.Status != AssemblyRunnerStatus.Idle) // because of https://github.com/xunit/xunit/issues/1347
            {
                Thread.Sleep(10);
            }
            runner.Dispose();
        }
示例#2
0
 public ResultProxy(ICollector <TestResult> storageTable, TestTypeInfo testTypeInfo)
 {
     _collector    = storageTable;
     _partitionKey = testTypeInfo.Guid.ToString();
 }