protected when_running_specs Run(params Type[] types) { //if (types.Count() == 1) tags = types.First().Name; this.types = types; builder = new ContextBuilder(new SpecFinder(types), new Tags().Parse(tags), new DefaultConventions()); runner = new ContextRunner(builder, formatter, failFast); contextCollection = builder.Contexts(); contextCollection.Build(); classContext = contextCollection .AllContexts() .Where(c => c is ClassContext) .Cast<ClassContext>() .FirstOrDefault(c => types.Contains(c.type)); methodContext = contextCollection.AllContexts().FirstOrDefault(c => c is MethodContext); runner.Run(contextCollection); return this; }
protected when_running_specs Init(Type[] types, string tags = null, bool failFast = false) { this.types = types; builder = new ContextBuilder(new SpecFinder(types), new Tags().Parse(tags), new DefaultConventions()); runner = new ContextRunner(builder, formatter, failFast); contextCollection = builder.Contexts(); contextCollection.Build(); classContext = contextCollection .AllContexts() .Where(c => c is ClassContext) .Cast<ClassContext>() .FirstOrDefault(c => types.Contains(c.type)); methodContext = contextCollection.AllContexts().FirstOrDefault(c => c is MethodContext); return this; }
public static Context Find(this ContextCollection contextCollection, string name) { return(contextCollection.AllContexts().SingleOrDefault(c => c.Name == name)); }