static int Main(string[] args) { try { var commandLineParser = new CommandLineParser(args); if (commandLineParser.HasErrors) { using (Foreground.Red) foreach (var error in commandLineParser.Errors) { Console.WriteLine(error); } Console.WriteLine(); Console.WriteLine(CommandLineParser.Usage()); return(FatalError); } var summary = Execute(commandLineParser); return(summary.Failed); } catch (Exception exception) { using (Foreground.Red) Console.WriteLine($"Fatal Error: {exception}"); return(FatalError); } }
static int Main(string[] args) { try { var commandLineParser = new CommandLineParser(args); if (commandLineParser.HasErrors) { using (Foreground.Red) foreach (var error in commandLineParser.Errors) { Console.WriteLine(error); } Console.WriteLine(); Console.WriteLine(CommandLineParser.Usage()); return(FatalError); } foreach (var assemblyPath in commandLineParser.AssemblyPaths) { if (!File.Exists(assemblyPath)) { using (Foreground.Red) Console.WriteLine("Specified test assembly does not exist: " + assemblyPath); Console.WriteLine(); Console.WriteLine(CommandLineParser.Usage()); return(FatalError); } } var executionResult = new ExecutionResult(); var stopwatch = new Stopwatch(); stopwatch.Start(); foreach (var assemblyPath in commandLineParser.AssemblyPaths) { var result = Execute(assemblyPath, commandLineParser.Options); executionResult.Add(result); } stopwatch.Stop(); if (executionResult.AssemblyResults.Count > 1) { Summarize(executionResult, stopwatch.Elapsed); } ProduceReports(commandLineParser.Options, executionResult); return(executionResult.Failed); } catch (Exception exception) { using (Foreground.Red) Console.WriteLine("Fatal Error: {0}", exception); return(FatalError); } }