Example #1
0
        public TestRunner(Assembly assembly, TestMethodProvider <TTestMethod> testMethodProvider, ILogger logger = null)
        {
            Assembly           = assembly;
            ParameterProvider  = CommandLineInterface.GetParameters;
            TestMethodProvider = testMethodProvider;
            TestSummary        = new TestRunnerSummary();
            IsolateMethodCalls = true;
            logger             = logger ?? Log.Default;

            _tests = new Lazy <List <TTestMethod> >(() => TestMethodProvider.GetTests());

            Subscribe(logger);
            AttachBeforeHandlers();
            AttachAfterHandlers();
        }
Example #2
0
        public void RunAllTests()
        {
            List <TTestMethod> tests = TestMethodProvider.GetTests();

            if (tests.Count == 0)
            {
                FireEvent(NoTestsDiscovered);
                return;
            }

            FireEvent(TestsDiscovered, new TestsDiscoveredEventArgs <TTestMethod> {
                Assembly = Assembly, TestRunner = this, Tests = tests.Select(t => (TestMethod)t).ToList()
            });
            FireEvent(TestsStarting, new TestEventArgs <TTestMethod> {
                TestRunner = this, Assembly = Assembly
            });
            foreach (TestMethod test in tests)
            {
                RunTest(test);
            }
            FireEvent(TestsFinished, new TestEventArgs <TTestMethod> {
                TestRunner = this, Assembly = Assembly
            });
        }