public void accept_visitor_for_DependencyInterceptor() { var target = new Target(); var inner = Constant.For(target); var decorator = new DecoratorInterceptor(typeof(ITarget), typeof(DecoratedTarget)); var plan = new InterceptionPlan(typeof(ITarget), inner, Policies.Default(), new IInterceptor[] { decorator }); plan.AcceptVisitor(theVisitor); theVisitor.AssertWasCalled(x => x.Decorator(decorator)); }
public void accept_visitor_for_func_decorator() { var target = new Target(); var inner = Constant.For(target); var decorator = new FuncInterceptor<ITarget>((s, t) => new ContextKeepingTarget(s, t)); var plan = new InterceptionPlan(typeof(ITarget), inner, Policies.Default(), new IInterceptor[] { decorator }); plan.AcceptVisitor(theVisitor); theVisitor.AssertWasCalled(x => x.Decorator(decorator)); }
public void accept_visitor_for_DependencyInterceptor() { var target = new Target(); var inner = Constant.For(target); var decorator = new DecoratorInterceptor(typeof(ITarget), typeof(DecoratedTarget)); var plan = new InterceptionPlan(typeof(ITarget), inner, new Policies(), new IInterceptor[] { decorator }); plan.AcceptVisitor(theVisitor); theVisitor.AssertWasCalled(x => x.Decorator(decorator)); }
public void accept_visitor_for_func_decorator() { var target = new Target(); var inner = Constant.For(target); var decorator = new FuncInterceptor <ITarget>((s, t) => new ContextKeepingTarget(s, t)); var plan = new InterceptionPlan(typeof(ITarget), inner, new Policies(), new IInterceptor[] { decorator }); plan.AcceptVisitor(theVisitor); theVisitor.AssertWasCalled(x => x.Decorator(decorator)); }
public void accept_visitor_for_DependencyInterceptor() { var target = new Target(); var inner = Constant.For(target); var decorator = new DecoratorInterceptor(typeof(ITarget), typeof(DecoratedTarget)); var plan = new InterceptionPlan(typeof(ITarget), inner, Policies.Default(), new IInterceptor[] { decorator }); plan.AcceptVisitor(theVisitor); theVisitor.Received().Decorator(decorator); }
public void accept_visitor_for_activator() { var target = new Target(); var inner = Constant.For(target); var interceptor = new ActivatorInterceptor<Target>(x => x.ThrowUp()); var plan = new InterceptionPlan(typeof(ITarget), inner, Policies.Default(), new IInterceptor[] { interceptor }); plan.AcceptVisitor(theVisitor); theVisitor.AssertWasCalled(x => x.Activator(interceptor)); }
public void accept_visitor_for_activator() { var target = new Target(); var inner = Constant.For(target); var interceptor = new ActivatorInterceptor <Target>(x => x.ThrowUp()); var plan = new InterceptionPlan(typeof(ITarget), inner, new Policies(), new IInterceptor[] { interceptor }); plan.AcceptVisitor(theVisitor); theVisitor.AssertWasCalled(x => x.Activator(interceptor)); }