public void TestReturn() { var p = (TestProxy)ProxyBuilder.GetProxyObject(typeof(TestProxy), new DebugProxyHandler()); var r = p.TestReturn(1, 2); Assert.AreEqual(r, 3); }
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); }
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"); }
public void TestInfterface() { try { ProxyBuilder.GetProxyObject(typeof(IA), new DebugProxyHandler()); Assert.Fail(); } catch (Exception ex) { Assert.AreEqual(ex.Message, "ProxyBuilder不支持对抽象类与接口的代理"); } }
public void TestGenericesClass() { try { ProxyBuilder.GetProxyObject(typeof(List <string>), new DebugProxyHandler()); Assert.Fail(); } catch (Exception ex) { Assert.AreEqual(ex.Message, "ProxyBuilder不支持泛型类"); } }
public void TestSealedClass() { try { ProxyBuilder.GetProxyObject(typeof(SealedA), new DebugProxyHandler()); Assert.Fail(); } catch (Exception ex) { Assert.AreEqual(ex.Message, "ProxyBuilder不支持有sealed修饰的类"); } }
public void Test() { ProxyBuilder.GetProxyObject(typeof(TestProxy), new DebugProxyHandler()); }
public void TestNOTReturn() { var p = (TestProxy)ProxyBuilder.GetProxyObject(typeof(TestProxy), new DebugProxyHandler()); p.TestNOTReturn(1, 2); }