public string List(string testAssemblyPath) { var exampleSelector = new ExampleSelector(testAssemblyPath); var discoveredExamples = exampleSelector.Select(); string serialized = JsonConvert.SerializeObject(discoveredExamples); return(serialized); }
public void setup() { selector = new ExampleSelector(testAssemblyPath); actuals = selector.Select(); }
public override async Task <int> ExecuteAsync(CommandContext context, Settings settings) { if (settings.All) { var finder = new ExampleFinder(_fileSystem, _environment, _globber, settings.Skip); var runner = new ExampleRunner(_console, finder); return(await runner.RunAll(context.Remaining).ConfigureAwait(false)); } else if (settings.Select) { var finder = new ExampleFinder(_fileSystem, _environment, _globber, settings.Skip); var selector = new ExampleSelector(_console, finder); var example = selector.Select(); if (example == null) { return(-1); } if (settings.Source) { var sourceLister = new ExampleSourceLister(_fileSystem, _globber); if (!sourceLister.List(example)) { return(-1); } return(0); } else { var runner = new ExampleRunner(_console, finder); return(await runner.Run(example.Name, context.Remaining).ConfigureAwait(false)); } } else if (settings.List || string.IsNullOrWhiteSpace(settings.Name)) { var finder = new ExampleFinder(_fileSystem, _environment, _globber, settings.Skip); // Only one example? var examples = finder.FindExamples(); if (examples.Count == 1) { // Execute it var runner = new ExampleRunner(_console, finder); return(await runner.Run(examples[0].Name, context.Remaining).ConfigureAwait(false)); } var lister = new ExampleLister(_console, finder); lister.List(); return(0); } else if (settings.Source) { var finder = new ExampleFinder(_fileSystem, _environment, _globber, settings.Skip); var example = finder.FindExample(settings.Name); if (example == null) { return(-1); } var lister = new ExampleSourceLister(_fileSystem, _globber); if (!lister.List(example)) { return(-1); } return(0); } else { var finder = new ExampleFinder(_fileSystem, _environment, _globber, settings.Skip); var runner = new ExampleRunner(_console, finder); return(await runner.Run(settings.Name, context.Remaining).ConfigureAwait(false)); } }