예제 #1
0
 /// <summary>
 /// Print program usage information
 /// </summary>
 ///
 static void Usage()
 {
     EventHandlerPipeline.Raise(new ProgramUsageEvent()
     {
         Lines = ArgumentParser.GetUsage()
     });
 }
예제 #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);
            }
        }