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 void Run(Type type) { classContext = new ClassContext(type, convention); var method = type.Methods().First().Name; Run(type, method); }
public void setup() { parentContext = new ClassContext(typeof(parent_act)); childContext = new ClassContext(typeof(child_act)); parentContext.AddContext(childContext); instance = new child_act(); parentContext.Build(); }
public static Context RootContext(this Type type, Context childContext=null) { if (type.BaseType == typeof(nspec)) { var context = new ClassContext( type ); if(childContext!=null) context.AddContext(childContext); return context; } return RootContext(type.BaseType, new ClassContext(type)); }
protected void Run(Type type, string methodName) { classContext = new ClassContext(type, convention); var method = type.Methods().Single(s => s.Name == methodName); methodContext = new MethodContext(method); classContext.AddContext(methodContext); classContext.Build(); classContext.Run(); }
public ContextCollection Contexts() { contexts.Clear(); conventions.Initialize(); var specClasses = finder.SpecClasses(); var container = new ClassContext(typeof(nspec), conventions, tagsFilter); Build(container, specClasses); contexts.AddRange(container.Contexts); return contexts; }
public ClassContext CreateClassContext(Type type) { var tagAttributes = ((TagAttribute[])type.GetCustomAttributes(typeof(TagAttribute), false)).ToList(); tagAttributes.Add(new TagAttribute(type.Name)); type.GetAbstractBaseClassChainWithClass() .Where(s => s != type) .Each(s => tagAttributes.Add(new TagAttribute(s.Name))); var tags = TagStringFor(tagAttributes); var context = new ClassContext(type, conventions, tagsFilter, tags); return context; }
public ClassContext CreateClassContext(Type type) { var tagAttributes = ((TagAttribute[])type.GetTypeInfo().GetCustomAttributes(typeof(TagAttribute), false)).ToList(); tagAttributes.Add(new TagAttribute(type.Name)); type.GetAbstractBaseClassChainWithClass() .Where(s => s != type) .Do(s => tagAttributes.Add(new TagAttribute(s.Name))); var tags = TagStringFor(tagAttributes); var context = new ClassContext(type, conventions, tagsFilter, tags); return(context); }
public ContextCollection Contexts() { contexts.Clear(); conventions.Initialize(); var specClasses = finder.SpecClasses().OrderBy(type => type.Name); var container = new ClassContext(typeof(nspec), conventions, tagsFilter); Build(container, specClasses); contexts.AddRange(container.Contexts); return(contexts); }
protected void Run(Type type) { var finder = new SpecFinder(new[] { type }); var builder = new ContextBuilder(finder, new DefaultConventions()); var contexts = builder.Contexts(); contexts.Build(); contexts.Run(); classContext = contexts .AllContexts() .Select(c => c as ClassContext) .First(c => c.type == type); methodContext = contexts.AllContexts().First(c => c is MethodContext); }
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 void setup() { conventions = new DefaultConventions(); conventions.Initialize(); parentContext = new ClassContext(typeof(parent_before), conventions); childContext = new ClassContext(typeof(child_before), conventions); parentContext.AddContext(childContext); }
public ClassContext CreateClassContext(Type type) { var tagAttributes = ((TagAttribute[])type.GetCustomAttributes(typeof(TagAttribute), false)).ToList(); tagAttributes.Add(new TagAttribute(type.Name)); var tags = TagStringFor(tagAttributes); var context = new ClassContext(type, conventions, tagsFilter, tags); return context; }
private ClassContext CreateClassContext(Type type, Conventions conventions) { var context = new ClassContext(type, conventions); BuildMethodContexts(context, type); BuildMethodLevelExamples(context, type); return context; }