Exemplo n.º 1
0
        private void Run(string path, TestFixtureClass fixtureClass, TestCaseFilter filter, TestReporter reporter)
        {
            reporter.BeginSuite(fixtureClass);
            if (fixtureClass.HasIgnoreAttribute)
            {
                reporter.Ignore(fixtureClass.IgnoreMessage);
                reporter.EndSuite(fixtureClass, 0);
                return;
            }

            TestFixture fixture   = null;
            bool        setupDone = false;

            try
            {
                fixture = fixtureClass.CreateInstance();
                fixture.TestFixtureSetUp();
                setupDone = true;
            }
            catch (System.Exception e)
            {
                Exception.Report(e, reporter);
            }

            foreach (var test in GetItemOrder(fixtureClass.Tests))
            {
                var testPath = path + '.' + test.Name;
                if (filter.Match(testPath))
                {
                    Run(setupDone, testPath, fixture, test, filter, reporter);
                }
            }

            if (setupDone)
            {
                TestFixtureTearDown(fixture, reporter);
            }

            reporter.EndSuite(fixtureClass, 0);
        }