public static TypeBehaviorBuilder WrapConditionally(this TypeBehaviorBuilder builder, Func<Type, Convention, Case[], bool> condition, TypeBehaviorAction setUp, TypeBehaviorAction tearDown) { return builder.Wrap((@class, convention, cases, innerBehavior) => { bool shouldRunSetupAndTeardown = condition(@class, convention, cases); if (shouldRunSetupAndTeardown) setUp(@class, convention, cases, innerBehavior); innerBehavior(); if (shouldRunSetupAndTeardown) tearDown(@class, convention, cases, innerBehavior); }); }
public TypeBehaviorBuilder Wrap(TypeBehaviorAction outer) { Behavior = new WrapBehavior(outer, Behavior); return this; }
public WrapBehavior(TypeBehaviorAction outer, TypeBehavior inner) { this.outer = outer; this.inner = inner; }
public TypeBehaviorBuilder Wrap(TypeBehaviorAction outer) { Behavior = new WrapBehavior(outer, Behavior); return(this); }
public WrapBehavior(TypeBehaviorAction outer, TypeBehavior inner) { this.outer = outer; this.inner = inner; }