Esempio n. 1
0
        public void ShouldPassWithInOutRef()
        {
            SignatureTestTarget target = GetTarget();
            string two;
            float  three = 1.0f;

            target.MethodWithInOutByrefParams(1, out two, ref three, 5.0M);
            Assert.AreEqual("owt", two);
            Assert.AreEqual(3.0f, three);
        }
Esempio n. 2
0
        public void ShouldPassWithOutParams()
        {
            SignatureTestTarget target = GetTarget();
            int    first;
            string second;

            target.MethodWithOutParams(out first, out second);
            Assert.AreEqual(1, first);
            Assert.AreEqual("two", second);
        }
Esempio n. 3
0
        SignatureTestTarget GetTarget()
        {
            TransparentProxyInterceptor interceptor = new TransparentProxyInterceptor();
            PolicySet           policySet           = GetPolicies();
            SignatureTestTarget target = new SignatureTestTarget();
            IInterceptingProxy  proxy  = interceptor.CreateProxy(typeof(SignatureTestTarget), target);

            foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(typeof(SignatureTestTarget), typeof(SignatureTestTarget)))
            {
                HandlerPipeline pipeline = new HandlerPipeline(
                    policySet.GetHandlersFor(method, container));
                proxy.SetPipeline(method.ImplementationMethodInfo, pipeline);
            }
            return((SignatureTestTarget)proxy);
        }
        SignatureTestTarget GetTarget()
        {
            TransparentProxyInterceptor interceptor = new TransparentProxyInterceptor();
            PolicySet policySet = GetPolicies();
            SignatureTestTarget target = new SignatureTestTarget();
            IInterceptingProxy proxy = interceptor.CreateProxy(typeof(SignatureTestTarget), target);

            PipelineManager manager = new PipelineManager();
            foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(typeof(SignatureTestTarget), typeof(SignatureTestTarget)))
            {
                HandlerPipeline pipeline = new HandlerPipeline(
                    policySet.GetHandlersFor(method, container));
                manager.SetPipeline(method.ImplementationMethodInfo, pipeline);
            }
            proxy.AddInterceptionBehavior(new PolicyInjectionBehavior(manager));

            return (SignatureTestTarget)proxy;
        }
        private ISignatureTestTarget GetTarget()
        {
            var                interceptor = new InterfaceInterceptor();
            PolicySet          policySet   = GetPolicies();
            var                target      = new SignatureTestTarget();
            IInterceptingProxy proxy       = interceptor.CreateProxy(typeof(ISignatureTestTarget), target);

            PipelineManager manager = new PipelineManager();

            foreach (MethodImplementationInfo method in interceptor.GetInterceptableMethods(typeof(ISignatureTestTarget), typeof(SignatureTestTarget)))
            {
                HandlerPipeline pipeline = new HandlerPipeline(
                    policySet.GetHandlersFor(method, container));
                manager.SetPipeline(method.ImplementationMethodInfo, pipeline);
            }
            proxy.AddInterceptionBehavior(new PolicyInjectionBehavior(manager));

            return((ISignatureTestTarget)proxy);
        }
Esempio n. 6
0
        public void ShouldPassWithVarArgs()
        {
            SignatureTestTarget target = GetTarget();

            target.MethodWithVarArgs(1, "two", "two and a half", "two and three quarters");
        }
Esempio n. 7
0
        public void ShouldPassWithSimpleInputs()
        {
            SignatureTestTarget target = GetTarget();

            target.MethodWithSimpleInputs(1, "two");
        }
Esempio n. 8
0
        public void ShouldPassWithNoParameters()
        {
            SignatureTestTarget target = GetTarget();

            target.MethodWithNoParameters();
        }