public void MethodStaticOnNonStaticTypeTest() { #if !NET5_0 return; #endif MethodInfo method = Utils.GetMethod <NonGenericInstanceClass>(nameof(NonGenericInstanceClass.StaticNonGeneric)); NonGenericInstanceClass.StaticNonGeneric(); MethodHelper.ForceRecompile(method); NonGenericInstanceClass.StaticNonGeneric(); int count = MethodsCompiled.ToList().Count(m => m == method); Assert.Equal(2, count); }
public void MethodStaticNonGenericOnNonStaticType(Type type) { #if !NET5_0 return; #endif Type baseType = typeof(GenericInstanceClass <>); MethodInfo method = Utils.GetMethodInfo(baseType, type, "StaticNonGeneric"); method.Invoke(null, null); MethodHelper.ForceRecompile(method); method.Invoke(null, null); method = (MethodInfo)MethodHelper.GetOriginalMethod(method); int count = MethodsCompiled.ToList().Count(m => m == method); Assert.Equal(2, count); }
public void MethodStaticGenericOnNonStaticTypeTest(Type type) { #if !NET5_0 return; #endif MethodInfo method = Utils.GetMethod <NonGenericInstanceClass>(nameof(NonGenericInstanceClass.StaticGeneric)); method = method.MakeGenericMethod(type); method.Invoke(null, null); MethodHelper.ForceRecompile(method); method.Invoke(null, null); method = (MethodInfo)MethodHelper.GetOriginalMethod(method); int count = MethodsCompiled.ToList().Count(m => m == method); Assert.Equal(2, count); }
public void MethodStaticGenericTest(Type baseTypeGenericParameter, Type methodGenericParameter) { #if !NET5_0 return; #endif Type baseType = typeof(GenericStaticClass <>); MethodInfo method = Utils.GetMethodInfo(baseType, baseTypeGenericParameter, "Generic"); method = method.MakeGenericMethod(methodGenericParameter); method.Invoke(null, null); MethodHelper.ForceRecompile(method); method.Invoke(null, null); method = (MethodInfo)MethodHelper.GetOriginalMethod(method); int count = MethodsCompiled.ToList().Count(m => m == method); Assert.Equal(2, count); }