static void Main(string[] args) { if (args.Length == 0) { ShowUsage(); return; } try { var classFilter = args.Length > 1 ? args[1] : ""; var specDLL = args[0]; var domain = new NSpecDomain(specDLL + ".config"); var console = new ConsoleFormatter(); domain.Run(specDLL, classFilter, console, (dll, filter, formatter) => { var finder = new SpecFinder(dll, new Reflector(), filter); var builder = new ContextBuilder(finder, new DefaultConventions()); var runner = new ContextRunner(builder, formatter); runner.Run(); }); } catch (Exception e) { //hopefully this is handled before here, but if not, this is better than crashing the runner Console.WriteLine(e); } }
static void Main(string[] args) { if (args.Length == 0) { ShowUsage(); return; } try { // extract either a class filter or a tags filter (but not both) var argsTags = ""; var failFast = IsFailFast(args); var formatterClassName = GetFormatterClassName(args); var formatter = FindFormatter(formatterClassName); args = RemoveOptionsAndSwitches(args); if (args.Length > 1) { // see rspec and cucumber for ideas on better ways to handle tags on the command line: // https://github.com/cucumber/cucumber/wiki/tags // https://www.relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/tag-option if (args[1] == "--tag" && args.Length > 2) { argsTags = args[2]; } else { argsTags = args[1]; } } var specDLL = args[0]; var invocation = new RunnerInvocation(specDLL, argsTags, formatter, failFast); var domain = new NSpecDomain(specDLL + ".config"); var failures = domain.Run(invocation, i => i.Run().Failures().Count(), specDLL); if (failures > 0) { Environment.Exit(1); } } catch (Exception e) { //hopefully this is handled before here, but if not, this is better than crashing the runner Console.WriteLine(e); Environment.Exit(1); } }
static void Main(string[] args) { if (args.Length == 0) { ShowUsage(); return; } try { // extract either a class filter or a tags filter (but not both) var argsTags = ""; var failFast = IsFailFast(args); var formatterClassName = GetFormatterClassName(args); var formatter = FindFormatter(formatterClassName); args = RemoveOptionsAndSwitches(args); if (args.Length > 1) { // see rspec and cucumber for ideas on better ways to handle tags on the command line: // https://github.com/cucumber/cucumber/wiki/tags // https://www.relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/tag-option if (args[1] == "--tag" && args.Length > 2) argsTags = args[2]; else argsTags = args[1]; } var specDLL = args[0]; var invocation = new RunnerInvocation(specDLL, argsTags, formatter, failFast); var domain = new NSpecDomain(specDLL + ".config"); var failures = domain.Run(invocation, i => i.Run().Failures().Count(), specDLL); if (failures > 0) Environment.Exit(1); } catch (Exception e) { //hopefully this is handled before here, but if not, this is better than crashing the runner Console.WriteLine(e); Environment.Exit(1); } }