Beispiel #1
0
        private void Run(bool ok, TestFixture fixture, Test test, TestCase testCase, TestReporter reporter)
        {
            reporter.BeginTest(testCase);
            if (!ok)
            {
                reporter.EndTest(testCase, 0, TestCaseState.Failed);
                return;
            }

            bool          setUpDone = false;
            TestCaseState runState  = TestCaseState.Failed;

            try
            {
                fixture.SetUp();
                setUpDone = true;
                testCase.Run(fixture, reporter);
                runState = TestCaseState.Success;
            }
            catch (System.Exception e)
            {
                Exception.Report(e, reporter);
            }

            TestCaseState state = TestCaseState.Failed;

            if (setUpDone)
            {
                try
                {
                    fixture.TearDown();
                    state = runState;
                }
                catch (System.Exception e)
                {
                    Exception.Report(e, reporter);
                }
            }
            reporter.EndTest(testCase, 0, state);
        }