public void Setup() { formatter = new XUnitFormatter(); outDirPath = Path.Combine( Path.GetTempPath(), "NSpec.Tests", nameof(describe_XUnitFormatter)); Directory.CreateDirectory(outDirPath); outFilePath = Path.Combine( outDirPath, Path.ChangeExtension(Path.GetRandomFileName(), "xml")); formatter.Options = new Dictionary <string, string>() { { "file", outFilePath }, }; var invocation = new RunnerInvocation( dll: typeof(describe_XUnitFormatter).GetTypeInfo().Assembly.Location, tags: typeof(xunit_formatter_sample_spec).Name, formatter: formatter, failFast: false); contexts = invocation.Run(); }
public void Setup() { formatter = new FormatterStub(); var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, typeof(liveconsole_sample_spec).Name, formatter, false); contexts = invocation.Run(); }
public void Setup() { formatter = new FormatterStub(); var invocation = new RunnerInvocation(typeof(describe_LiveFormatter_with_context_filter).GetTypeInfo().Assembly.Location, typeof(liveconsole_sample_spec).Name, formatter, false); contexts = invocation.Run(); }
static void Main(string[] args) { var shouldShowHelp = false; var useXUnitFormatter = false; var options = new OptionSet { { "h|help", "show this message and exit", h => shouldShowHelp = h != null }, { "f|formatter", "console (default) | xunit", f => useXUnitFormatter = string.Compare(f, "xunit", StringComparison.InvariantCultureIgnoreCase) == 0 } }; if (shouldShowHelp) { Console.WriteLine("Usage: [OPTIONS] path/to/test.assembly.dll path/to/test.2.assembly.dll"); Console.WriteLine(); Console.WriteLine("Options:"); options.WriteOptionDescriptions(Console.Out); } IFormatter formatter = null; if (useXUnitFormatter) { formatter = new XUnitFormatter(); } else { formatter = new ConsoleFormatter(); } IEnumerable <FileInfo> extra; try { extra = options.Parse(args).Select(n => new FileInfo(n)).Where(n => n.Exists); foreach (var asm in extra) { var invocation = new RunnerInvocation(asm.FullName, null, formatter, false); var result = invocation.Run(); var failes = result.Failures().ToArray(); if (failes.Any()) { throw new Exception($"NSpec run of {asm} reported Failures"); } } } catch (OptionException e) { Console.WriteLine(e.Message); Console.WriteLine("Try `--help' for more information."); return; } }
static void Main(string[] args) { var ri = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, "", false); ri.Run(); Console.WriteLine("Done."); Console.ReadLine(); }
public void DebugAppSettingKeyCollectionSpecs() { const string tagOrClassName = "AppSettingKeyCollectionSpecs"; var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName); var contexts = invocation.Run(); //assert that there aren't any failures contexts.Failures().Count().should_be(0); }
public static void Main(string[] args) { var ri = new RunnerInvocation(Assembly.GetEntryAssembly().Location, "", false); var results = ri.Run(); if (results.Failures().Count() > 0) { Environment.Exit(1); } }
//tests can be run via TDD.net public void debug() { var tagOrClassName = ""; var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName); var contexts = invocation.Run(); contexts.Failures().Count().should_be(0); }
//[Test] public void debug() { var tagOrClassName = "describe_RollOffsController"; var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName); var contexts = invocation.Run(); //assert that there aren't any failures contexts.Failures().Count().should_be(0); }
//[Test] public void debug() { var tagOrClassName = "class_or_tag_you_want_to_debug"; var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName); var contexts = invocation.Run(); //assert that there aren't any failures contexts.Failures().Count().should_be(0); }
public SessionResults RunAssembly(Assembly assembly, IEnumerable <string> filters) { var sessionResults = new SessionResults(); var tags = string.Empty; if (filters.Any()) { tags = filters.Aggregate((working, next) => working + "," + next); } var runner = new RunnerInvocation(assembly.Location, tags, new GilesSessionResultsFormatter(sessionResults), false); runner.Run(); return(sessionResults); }
public void NSpec() { if (nspecCollection != null) { foreach (var tagOrClassName in nspecCollection) { var invocation = new RunnerInvocation(targetLocation, tagOrClassName); var contexts = invocation.Run(); // Uncomment the below line if the test invocation is to be stopped // as soon as a failure is detected. contexts.Failures().Count().should_be(0); } } }