Advertisement
Guest User

Test Executor

a guest
Jul 9th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using Microsoft.VisualStudio.TestPlatform.ObjectModel;
  2. using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TSTestAdapter
  8. {
  9.     [ExtensionUri(TSTestExecutor.ExecutorUriString)]
  10.     public class TSTestExecutor : ITestExecutor
  11.     {
  12.         private bool canceled = false;
  13.  
  14.         public const string ExecutorUriString = "executor://typescriptexecutor/v1";
  15.         public static readonly Uri ExecutorUri = new Uri(TSTestExecutor.ExecutorUriString);
  16.  
  17.         public void Cancel()
  18.         {
  19.             canceled = true;
  20.         }
  21.  
  22.         public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
  23.         {
  24.             var tests = TSTestDiscoverer.GetTests(sources, null);
  25.             RunTests(tests, runContext, frameworkHandle);
  26.         }
  27.  
  28.         public void RunTests(IEnumerable<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
  29.         {
  30.             Parallel.ForEach(tests, test =>
  31.             {
  32.                 var result = new TestResult(test);
  33.                 result.Outcome = TestOutcome.Passed;
  34.  
  35.                 frameworkHandle.RecordResult(result);
  36.             });
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement