예제 #1
0
        protected override Task <RunSummary> RunTestCaseAsync(IXunitTestCase testCase)
        {
            if (testCase.GetType() == typeof(XunitTestCase))
            {
                // If we get here this is a 'regular' test case, not something that represents a skipped test.
                //
                // We can take control of it's invocation thusly.
                var runner = new AspNetTestCaseRunner(
                    testCase,
                    testCase.DisplayName,
                    testCase.SkipReason,
                    _constructorArguments,
                    testCase.TestMethodArguments,
                    MessageBus,
                    new ExceptionAggregator(Aggregator),
                    CancellationTokenSource);
                return(runner.RunAsync());
            }

            if (testCase.GetType() == typeof(XunitTheoryTestCase))
            {
                // If we get here this is a 'regular' theory test case, not something that represents a skipped test.
                //
                // We can take control of it's invocation thusly.
                var runner = new AspNetTheoryTestCaseRunner(
                    testCase,
                    testCase.DisplayName,
                    testCase.SkipReason,
                    _constructorArguments,
                    _diagnosticMessageSink,
                    MessageBus,
                    new ExceptionAggregator(Aggregator),
                    CancellationTokenSource);
                return(runner.RunAsync());
            }

            return(base.RunTestCaseAsync(testCase));
        }
        private IXunitTestCase ConvertTestCase(IXunitTestCase testCase, TestMethodDisplay defaultMethodDisplay, int timeout, bool useStaThread)
        {
            var theory = testCase as XunitTheoryTestCase;

            if (theory != null)
            {
                return(ConvertTheoryTestCase(theory, defaultMethodDisplay, this.diagnosticMessageSink_, timeout, useStaThread));
            }

            if (testCase.GetType( ) == typeof(XunitTestCase))
            {
                return(ConvertXunitTestCase((XunitTestCase)testCase, defaultMethodDisplay, this.diagnosticMessageSink_, timeout, useStaThread));
            }

            return(testCase);
        }