public static ExitCode Run(string[] arguments) { Options options = new Options(); if (!options.ParseArguments(arguments)) { Console.WriteLine(Options.Usage()); return ExitCode.Failure; } try { List<Assembly> assemblies = GetAssemblies(options); if (assemblies.Count == 0) { Console.WriteLine(Options.Usage()); return ExitCode.Failure; } return RunAllInParallel(assemblies, options.GetRunOptions(), (uint)options.Threads).Result; } catch (Exception ex) { Console.WriteLine(ex.ToString()); return ExitCode.Error; } }
private static List<Assembly> GetAssemblies(Options options) { List<Assembly> assemblies = new List<Assembly>(); List<string> assemblyFiles = new List<string>(); if (options.AssemblyFiles != null) assemblyFiles.AddRange(options.AssemblyFiles); foreach (string assemblyName in assemblyFiles) { if (!File.Exists(assemblyName)) Console.WriteLine(String.Format("Error: Can't find assembly: {0}", assemblyName)); var excludedAssemblies = new [] { "Machine.Specifications.dll", "Machine.Specifications.Clr4.dll" }; if (excludedAssemblies.Any(x => Path.GetFileName(assemblyName) == x)) { Console.WriteLine("Warning: Excluded {0} from the test run because the file name matches either of these: {1}", assemblyName, String.Join(", ", excludedAssemblies)); continue; } Assembly assembly = Assembly.LoadFrom(assemblyName); assemblies.Add(assembly); } return assemblies; }