Beispiel #1
0
        static IEnumerable <TestResult> RunAllTests(IVsTestConsoleWrapper consoleWrapper, IEnumerable <string> sources)
        {
            var waitHandle = new AutoResetEvent(false);
            var handler    = new RunEventHandler(waitHandle);

            consoleWrapper.RunTests(sources, DefaultRunSettings, handler);

            waitHandle.WaitOne();
            return(handler.TestResults);
        }
Beispiel #2
0
        static IEnumerable <TestResult> RunSelectedTests(IVsTestConsoleWrapper consoleWrapper, IEnumerable <TestCase> testCases)
        {
            var waitHandle = new AutoResetEvent(false);
            var handler    = new RunEventHandler(waitHandle);

            consoleWrapper.RunTests(testCases, null, handler);

            waitHandle.WaitOne();
            return(handler.TestResults);
        }
Beispiel #3
0
        static IEnumerable <TestResult> RunAllTestsWithTestCaseFilter(IVsTestConsoleWrapper consoleWrapper, IEnumerable <string> sources)
        {
            var waitHandle = new AutoResetEvent(false);
            var handler    = new RunEventHandler(waitHandle);

            consoleWrapper.RunTests(sources, DefaultRunSettings, new TestPlatformOptions()
            {
                TestCaseFilter = "FullyQualifiedName=UnitTestProject.UnitTest.PassingTest"
            }, handler);

            waitHandle.WaitOne();
            return(handler.TestResults);
        }
Beispiel #4
0
        private static IEnumerable <TestResult> RunTestsWithCustomTestHostLauncher(IVsTestConsoleWrapper consoleWrapper, List <string> list)
        {
            var runCompleteSignal   = new AutoResetEvent(false);
            var processExitedSignal = new AutoResetEvent(false);
            var handler             = new RunEventHandler(runCompleteSignal);

            consoleWrapper.RunTestsWithCustomTestHost(list, DefaultRunSettings, handler, new CustomTestHostLauncher(() => processExitedSignal.Set()));

            // Test host exited signal comes after the run complete
            processExitedSignal.WaitOne();

            // At this point, run must have complete. Check signal for true
            Debug.Assert(runCompleteSignal.WaitOne());

            return(handler.TestResults);
        }