예제 #1
0
 public void CanCallMethodWithOutParameter()
 {
     int i;
     WithCallbackInterceptor interceptor = new WithCallbackInterceptor(delegate { });
     IWithRefOut proxy = (IWithRefOut)generator.CreateInterfaceProxyWithoutTarget(typeof(IWithRefOut), interceptor);
     proxy.Do(out i);
 }
예제 #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);
 }
예제 #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);
 }
예제 #4
0
 public void CanCreateComplexOutRefProxyOnClass()
 {
     int i = 3;
     string s1 = "2";
     string s2;
     WithCallbackInterceptor interceptor = new WithCallbackInterceptor(delegate(IInvocation invocation)
                                                                     {
                                                                         invocation.Arguments[0] = 5;
                                                                         invocation.Arguments[1] = "aaa";
                                                                         invocation.Arguments[3] = "bbb";
                                                                     });
     MyClass proxy = (MyClass)generator.CreateClassProxy(typeof(MyClass), interceptor);
     proxy.MyMethod(out i, ref s1, 1, out s2);
     Assert.AreEqual(5, i);
     Assert.AreEqual(s1, "aaa");
     Assert.AreEqual(s2, "bbb");
 }