예제 #1
0
        public void TestReturn()
        {
            var p = (TestProxy)ProxyBuilder.GetProxyObject(typeof(TestProxy), new DebugProxyHandler());
            var r = p.TestReturn(1, 2);

            Assert.AreEqual(r, 3);
        }
예제 #2
0
        public void TestRef()
        {
            var         p = (TestProxy)ProxyBuilder.GetProxyObject(typeof(TestProxy), new DebugProxyHandler());
            SimpleModel a = new SimpleModel(1, "abc");

            p.TestRef(a);
            Assert.AreEqual(a.Id, 1001);
        }
예제 #3
0
        public void TestReturnChange()
        {
            var p = (TestProxy)ProxyBuilder.GetProxyObject(typeof(TestProxy), new TestProxyHandler());
            var r = p.TestReturnChange();

            Assert.AreEqual(r.Id, 1001);
            Assert.AreEqual(r.Name, "a");
        }
예제 #4
0
 public void TestInfterface()
 {
     try
     {
         ProxyBuilder.GetProxyObject(typeof(IA), new DebugProxyHandler());
         Assert.Fail();
     }
     catch (Exception ex) {
         Assert.AreEqual(ex.Message, "ProxyBuilder不支持对抽象类与接口的代理");
     }
 }
예제 #5
0
 public void TestGenericesClass()
 {
     try
     {
         ProxyBuilder.GetProxyObject(typeof(List <string>), new DebugProxyHandler());
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.Message, "ProxyBuilder不支持泛型类");
     }
 }
예제 #6
0
 public void TestSealedClass()
 {
     try
     {
         ProxyBuilder.GetProxyObject(typeof(SealedA), new DebugProxyHandler());
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.Message, "ProxyBuilder不支持有sealed修饰的类");
     }
 }
예제 #7
0
 public void Test()
 {
     ProxyBuilder.GetProxyObject(typeof(TestProxy), new DebugProxyHandler());
 }
예제 #8
0
        public void TestNOTReturn()
        {
            var p = (TestProxy)ProxyBuilder.GetProxyObject(typeof(TestProxy), new DebugProxyHandler());

            p.TestNOTReturn(1, 2);
        }