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