public void BuildMethodContexts(Context classContext, Type specClass) { specClass.Methods().Where(s => !reservedMethods.Contains(s.Name)).Do( contextMethod => { var methodContext = new MethodContext(contextMethod); classContext.AddContext(methodContext); }); }
public void BuildMethodContexts(Context classContext, Type specClass) { specClass .Methods() .Where(s => conventions.IsMethodLevelContext(s.Name)).Do( contextMethod => { classContext.AddContext(new MethodContext(contextMethod)); }); }
public void BuildMethodContexts(Context classContext, Type specClass) { specClass.Methods().Where(s => !reservedMethods.Contains(s.Name)).Do( contextMethod => { var methodContext = new MethodContext(contextMethod); classContext.AddContext(methodContext); }); }
public void BuildMethodContexts(Context classContext, Type specClass) { specClass .Methods() .Where(s => conventions.IsMethodLevelContext(s.Name)).Do( contextMethod => { classContext.AddContext(new MethodContext(contextMethod)); }); }
public void should_be_marked_as_pending_if_any_parent_context_is_pending() { var parentContext = new Context("parent pending context", null, isPending: true); var context = new Context("not pending"); var example = new Example("example name"); parentContext.AddContext(context); context.AddExample(example); example.Pending.should_be_true(); }
public void BuildMethodContexts(Context classContext, Type specClass) { specClass .Methods() .Where(s => conventions.IsMethodLevelContext(s.Name)) .Do(contextMethod => { var methodContext = new MethodContext(contextMethod, TagStringFor(contextMethod)); classContext.AddContext(methodContext); }); }
public void given_nested_contexts_and_the_child_has_a_failure() { var child = new Context("child"); child.AddExample(new Example("") {Exception = new Exception()}); var parent = new Context("parent"); parent.AddContext(child); parent.Failures().Count().should_be(1); }
protected void Run(Type type, string methodName) { classContext = new ClassContext(type); var method = type.Methods().Single(s => s.Name == methodName); methodContext = new MethodContext(method); classContext.AddContext(methodContext); classContext.Run(); }
public void BuildMethodContexts(Context classContext, Type specClass) { specClass .Methods() .Where(s => conventions.IsMethodLevelContext(s.Name)) .Do(contextMethod => { var methodContext = new MethodContext(contextMethod, TagStringFor(contextMethod)); classContext.AddContext(methodContext); }); }
private void Build(Context parent, IEnumerable<Type> allSpecClasses) { var derivedTypes = allSpecClasses.Where(s => parent.IsSub( s.BaseType) ); foreach (var derived in derivedTypes) { var classContext = CreateClassContext(derived, conventions); parent.AddContext(classContext); Build(classContext, allSpecClasses); } }
private void Build(Context parent, IEnumerable <Type> allSpecClasses) { var derivedTypes = allSpecClasses.Where(s => parent.IsSub(s.BaseType)); foreach (var derived in derivedTypes) { var classContext = CreateClassContext(derived, conventions); parent.AddContext(classContext); Build(classContext, allSpecClasses); } }
public void should_prepend_successive_subcontexts_with_additional_indents() { var parent = new Context("parent context"); var child = new Context("child context"); var grandChild = new Context("grandchild context"); parent.AddContext(child); child.AddContext(grandChild); formatter.Write(parent).should_be_of_form("{0}parent context{0}{1}child context{0}{1}{1}grandchild context"); }
void Build(Context parent, IEnumerable <Type> allSpecClasses) { var derivedTypes = allSpecClasses.Where(s => parent.IsSub(s.BaseType)); foreach (var derived in derivedTypes) { var classContext = CreateClassContext(derived); parent.AddContext(classContext); BuildMethodContexts(classContext, derived); BuildMethodLevelExamples(classContext, derived); Build(classContext, allSpecClasses); } }
protected void AddContext(string name, Action action) { level++; var newContext = new Context(name, level); Context.AddContext(newContext); var beforeContext = Context; Context = newContext; action(); level--; Context = beforeContext; }
public void GivenContextWithAChildContextThatHasNoExample() { parentContext = GivenContextWithNoExamples(); childContext = GivenContextWithNoExamples(); parentContext.AddContext(childContext); rootContext.AddContext(parentContext); rootContext.AllContexts().should_contain(parentContext); }
void Build(Context parent, IEnumerable<Type> allSpecClasses) { var derivedTypes = allSpecClasses.Where(s => parent.IsSub(s.BaseType)); foreach (var derived in derivedTypes) { var classContext = CreateClassContext(derived); parent.AddContext(classContext); BuildMethodContexts(classContext, derived); BuildMethodLevelExamples(classContext, derived); Build(classContext, allSpecClasses); } }
public void given_nested_contexts_with_and_without_executed_examples() { var root = new Context( "root context" ); // add context with a skipped example root.AddContext( new Context( "context with no example" ) ); // add context with an executed example var context = new Context( "context with example" ); context.AddExample( new Example( "example" ) ); context.Examples[ 0 ].HasRun = true; root.AddContext( context ); // validate precondition root.Contexts.Count().should_be( 2 ); // perform trim operation root.TrimSkippedDescendants(); // validate postcondition root.Contexts.Count().should_be( 1 ); }