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);
            });
        }
Beispiel #2
0
 public TypeBehaviorBuilder Wrap(TypeBehaviorAction outer)
 {
     Behavior = new WrapBehavior(outer, Behavior);
     return this;
 }
Beispiel #3
0
 public WrapBehavior(TypeBehaviorAction outer, TypeBehavior inner)
 {
     this.outer = outer;
     this.inner = inner;
 }
Beispiel #4
0
 public TypeBehaviorBuilder Wrap(TypeBehaviorAction outer)
 {
     Behavior = new WrapBehavior(outer, Behavior);
     return(this);
 }
Beispiel #5
0
 public WrapBehavior(TypeBehaviorAction outer, TypeBehavior inner)
 {
     this.outer = outer;
     this.inner = inner;
 }