Example #1
0
        public void CanCallMethodWithOutParameter()
        {
            int i;
            WithCallbackInterceptor interceptor = new WithCallbackInterceptor(delegate { });
            IWithRefOut             proxy       = (IWithRefOut)generator.CreateInterfaceProxyWithoutTarget(typeof(IWithRefOut), interceptor);

            proxy.Do(out i);
        }
Example #2
0
        public void CanCreateProxyWithRefParam()
        {
            int i = 3;
            WithCallbackInterceptor interceptor =
                new WithCallbackInterceptor(delegate(IInvocation invocation) { invocation.Arguments[0] = 5; });
            IWithRefOut proxy = (IWithRefOut)generator.CreateInterfaceProxyWithoutTarget(typeof(IWithRefOut), interceptor);

            proxy.Did(ref i);
            Assert.AreEqual(5, i);
        }
Example #3
0
        public void CanAffectValueOfOutParameter()
        {
            int i;
            WithCallbackInterceptor interceptor =
                new WithCallbackInterceptor(delegate(IInvocation invocation) { invocation.Arguments[0] = 5; });
            IWithRefOut proxy = (IWithRefOut)generator.CreateInterfaceProxyWithoutTarget(typeof(IWithRefOut), interceptor);

            proxy.Do(out i);
            Assert.AreEqual(5, i);
        }