Exemple #1
0
        TestResult RunTest(EventListener listener)
        {
            listener.TestStarted(base.TestName);

            TestResult nunitTestResult = new TestResult(this);

            if (_pendingException != null)
            {
                nunitTestResult.Failure(_pendingException.Message, _pendingException.StackTrace, FailureSite.Test);
            }
            else if (RunState == RunState.NotRunnable)
            {
                nunitTestResult.SetResult(ResultState.NotRunnable, IgnoreReason, "", FailureSite.Test);
            }
            else
            {
                var testResult = SpecificationRunner.RunTest(this._testContext, new List <string>());

                NativeTestResult.ApplyToNunitResult(testResult, nunitTestResult);
            }

            listener.TestFinished(nunitTestResult);

            return(nunitTestResult);
        }
Exemple #2
0
        protected override void DoOneTimeTearDown(TestResult suiteResult)
        {
            try
            {
                _testContext.FixtureContext.GlobalSetupManager.Cleanup(_testContext.Position);
            }
            catch (Exception innerException)
            {
                NUnitException exception2 = innerException as NUnitException;
                if (exception2 != null)
                {
                    innerException = exception2.InnerException;
                }

                var shim = new TestResultShim();
                TestResultUtil.Error(shim, suiteResult.Test.GetMultilineName(), innerException, null, TestResultShim.Site.TearDown);
                NativeTestResult.ApplyToNunitResult(shim, suiteResult);
            }
        }