示例#1
0
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            if (runContext.KeepAlive)
            {
                frameworkHandle.EnableShutdownAfterTestRun = true;
            }

            var testCaseGroupedBySource = tests.ToList().GroupBy(test => test.Source);

            foreach (var groupedTestCases in testCaseGroupedBySource)
            {
                var listener = new VisualStudioTestListener(frameworkHandle, groupedTestCases.Key);
                var runner   = new Runner(listener);
                foreach (var test in groupedTestCases)
                {
                    if (_cancelled)
                    {
                        break;
                    }

                    var assembly   = Assembly.Load(AssemblyName.GetAssemblyName(@test.Source));
                    var methodInfo = GetMethodInfoFromMethodName(assembly, test.FullyQualifiedName);

                    runner.RunMethod(assembly, methodInfo);
                }
            }
        }
示例#2
0
        public void RunTests(IEnumerable <string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            if (runContext.KeepAlive)
            {
                frameworkHandle.EnableShutdownAfterTestRun = true;
            }

            foreach (var source in sources)
            {
                if (_cancelled)
                {
                    break;
                }

                var listener = new VisualStudioTestListener(frameworkHandle, @source);
                var runner   = new Runner(listener);
                runner.RunAssembly(Assembly.Load(AssemblyName.GetAssemblyName(@source)));
            }
        }