コード例 #1
0
ファイル: RecompileTests.cs プロジェクト: little3388/Jitex
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: RecompileTests.cs プロジェクト: little3388/Jitex
        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);
        }
コード例 #4
0
        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);
        }