示例#1
0
        private static string Label(TestFixtureClass fixture)
        {
            var  categories = string.Join(",", fixture.Categories);
            char type       = fixture.HasExplicitAttribute || fixture.HasIgnoreAttribute ? 's' : 'S';

            return(string.Format("{0}{1}:[{2}]{3}", type, fixture.Id, categories, fixture.Name));
        }
示例#2
0
 static private void List(string indent, TestFixtureClass fixture)
 {
     System.Console.WriteLine(indent + Label(fixture));
     foreach (var test in fixture.Tests)
     {
         List(indent + "  ", test);
     }
 }
示例#3
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);
        }