private void Run(string[] args) { var commandLine = new CommandLine(args); var scanner = new VisualStudioAssemblyScanner(services); var assemblyNames = libraryManager.GetReferencingLibraries("machine.specifications").SelectMany(l => l.Assemblies); foreach (var assemblyName in assemblyNames) { var assembly = loadContext.Load(assemblyName); if (commandLine.DesignTime) { scanner.SendToVisualStudio(assembly); var listener = new AggregateRunListener(new ISpecificationRunListener[] { new VisualStudioRunListener(services) }); var runner = new DefaultRunner(listener, RunOptions.Default); if (commandLine.Tests.Any()) { var converter = new VisualStudioTestConverter(); var contexts = scanner.GetContexts(assembly); foreach (var context in contexts) { foreach (var specification in context.Specifications) { var test = converter.GetVisualStudioTest(context, specification); if (commandLine.Tests.Any(t => t == test.FullyQualifiedName)) { runner.RunMember(assembly, specification.FieldInfo); } } } } else { runner.RunAssembly(assembly); } } else { var listener = new AggregateRunListener(new ISpecificationRunListener[] { new OutputRunListener(new ColorOutput(new VerboseOutput(new DefaultConsole()))), }); var runner = new DefaultRunner(listener, RunOptions.Default); runner.RunAssembly(assembly); } } }
public AssemblyRunner(ISpecificationRunListener listener, RunOptions options) { var state = new RedirectOutputState(); this.options = options; this.listener = new AggregateRunListener(new[] { new AssemblyLocationAwareListener(), new SetUpRedirectOutputRunListener(state), listener, new TearDownRedirectOutputRunListener(state), }); assemblyStart = OnAssemblyStart; assemblyEnd = OnAssemblyEnd; }
public AssemblyRunner(ISpecificationRunListener listener, RunOptions options) { RedirectOutputState state = new RedirectOutputState(); _listener = new AggregateRunListener(new[] { new AssemblyLocationAwareListener(), new SetUpRedirectOutputRunListener(state), listener, new TearDownRedirectOutputRunListener(state), }); _options = options; _explorer = new AssemblyExplorer(); _executedAssemblyContexts = new List<IAssemblyContext>(); _assemblyStart = OnAssemblyStart; _assemblyEnd = OnAssemblyEnd; }
public AssemblyRunner(ISpecificationRunListener listener, RunOptions options) { RedirectOutputState state = new RedirectOutputState(); _listener = new AggregateRunListener(new[] { new AssemblyLocationAwareListener(), new SetUpRedirectOutputRunListener(state), listener, new TearDownRedirectOutputRunListener(state), }); _options = options; _explorer = new AssemblyExplorer(); _executedAssemblyContexts = new List <IAssemblyContext>(); _assemblyStart = OnAssemblyStart; _assemblyEnd = OnAssemblyEnd; }