Esempio n. 1
0
        protected sealed override TestCaseResult RunTestCore(TestExecutionContext testContext)
        {
            var options = NewTestOptions();
            var result  = new TestCaseResult((TestCaseInfo)this);

            result.Starting();

            Func <TestExecutionContext, object> testFunc = CoreRunTest;

            var groupedByPhase = options.Filters.GroupBy(GetPhaseForFilter);
            var metadataPhase  = groupedByPhase.FirstOrDefault(g => g.Key == Phase.MetadataOnly) ?? EMPTY_FILTERS;
            var execPhase      = groupedByPhase.FirstOrDefault(g => g.Key == Phase.Assertion) ?? EMPTY_FILTERS;
            var filters        = metadataPhase
                                 .Concat(new ITestCaseFilter[] {
                new PredeterminedStatusCommand(result)
            }).Concat(execPhase)
                                 .Concat(new ITestCaseFilter[] {
                new RunCommand(testFunc, result, options)
            });

            var winder = new TestCaseCommandWinder(filters);

            try {
                winder.RunAll(testContext);
            } catch (Exception ex) {
                result.SetFailed(ex);
            }

            result.Done(null, testContext.TestRunnerOptions);
            return(result);
        }
Esempio n. 2
0
        internal TestCaseResult AbortTest(TestExecutionContext testContext)
        {
            var result     = new TestCaseResult(this, TestStatus.Skipped);
            var runnerOpts = testContext.TestRunnerOptions;

            result.Starting();
            result.Done(this, runnerOpts);
            return(result);
        }