Exemplo n.º 1
0
        /// <summary>
        /// --inproc: Run an individual test file in-process
        /// </summary>
        ///
        static int InProc(string testFile)
        {
            var eventHandler = new ResultAccumulatingEventHandler();

            using (EventHandlerPipeline.Append(eventHandler))
            {
                TestAssemblyRunner.Run(testFile);
            }
            return(eventHandler.TestAssemblyResults.Last().Success ? 0 : 1);
        }
Exemplo n.º 2
0
        static int Main3(string[] args)
        {
            //
            // Route trace output to stdout
            //
            Trace.Listeners.Add(new TestRunnerTraceListener());

            //
            // Parse arguments
            //
            ArgumentParser.Parse(args);
            if (!ArgumentParser.Success)
            {
                WriteLine();
                WriteLine(ArgumentParser.GetUsage());
                WriteLine();
                WriteLine();
                WriteLine(ArgumentParser.ErrorMessage);
                return(1);
            }

            //
            // Parent process: Print the program banner and invoke TestRunner --inproc child processes for each
            // <testassembly> specified on the command line
            //
            if (!ArgumentParser.InProc)
            {
                Banner();
                bool success = true;
                foreach (var assemblyPath in ArgumentParser.AssemblyPaths)
                {
                    var exitCode =
                        ProcessExtensions.ExecuteDotnet(
                            ProgramPath,
                            "--inproc \"" + assemblyPath + "\"")
                        .ExitCode;

                    if (exitCode != 0)
                    {
                        success = false;
                    }
                }
                return(success ? 0 : 1);
            }

            //
            // Child process: Run the tests in the specified <testassembly>
            //
            else
            {
                return(TestAssemblyRunner.Run(ArgumentParser.AssemblyPaths[0]) ? 0 : 1);
            }
        }