public void MethodLookupTest3() { var holder = new GenericMethodHolder(typeof(GenericMethodHolderTests), "MyTest", 2); var result = holder.Invoke(this, new[] { GetType(), GetType() }); Assert.AreEqual("MyTest<T, X>()", result); }
public void MethodLookupTest1() { var holder = new GenericMethodHolder(typeof(GenericMethodHolderTests), "MyTest", 2, null, null, typeof(int), typeof(bool)); var result = holder.Invoke(this, new[] { typeof(object), typeof(object) }, null, null, 1, true); Assert.AreEqual("MyTest<T, X>(T t, X x, int a, bool b)", result); Assert.AreEqual("System.String MyTest[T,X](T, X, Int32, Boolean)", holder.ToString()); }
public void MethodLookupTest2() { var holder = new GenericMethodHolder(typeof(GenericMethodHolderTests), "MyTest", 2, typeof(int), typeof(string)); var result1 = holder.Invoke(this, new[] { typeof(object), typeof(object) }, 1, "123"); var result2 = holder.Invoke(this, new[] { typeof(object), typeof(object) }, 1, "123"); // test cache Assert.AreEqual("MyTest<T, X>(int a, string b)", result1); Assert.AreEqual(result1, result2); }
public NonGenericWrapper(IGenericInterface remote) { instance = remote; // wrap generic methods getDefaultHolder = new GenericMethodHolder(typeof(IGenericInterface), "GetDefault", 1, new Type[0]); equalsHolder = new GenericMethodHolder(typeof(IGenericInterface), "Equals", 1, new Type[] { null, null }); doSomethingHolder = new GenericMethodHolder(typeof(IGenericInterface), "DoSomething", 3, new Type[] { null, null, null }); computeHolder = new GenericMethodHolder(typeof(IGenericInterface), "Compute", 2, new Type[] { null, typeof(int), typeof(string) }); }
public void MethodLookupFailureTest() { var holder = new GenericMethodHolder(typeof(GenericMethodHolderTests), "MyTest", 0, typeof(int), typeof(bool)); }