Example #1
0
        public static void DoTest()
        {
            GenericClassTest <int> a = new GenericClassTest <int>();

            if (DelegateTest.GenericDelegateTest != null)
            {
                DelegateTest.GenericDelegateTest(a);
            }
        }
Example #2
0
        public static void DelegateTest35()
        {
            ILRuntimeTest.TestFramework.DelegateTest cls = new ILRuntimeTest.TestFramework.DelegateTest();
            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest2 = Delegate.CreateDelegate(typeof(IntDelegate2), cls, typeof(ILRuntimeTest.TestFramework.DelegateTest).GetMethod(nameof(ILRuntimeTest.TestFramework.DelegateTest.TestIntDelegateInstance))) as IntDelegate2;

            var res = ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest2(100);

            if (res != 999)
            {
                throw new Exception();
            }
        }
Example #3
0
        public static void DelegateTest01()
        {
            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += IntTest;
            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += IntTest2;

            DelegateTestCls cls = new DelegateTestCls(1000);

            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += cls.IntTest;
            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += cls.IntTest2;

            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest(123);

            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateEventTest += IntTest;
            ILRuntimeTest.TestFramework.DelegateTest.TestEvent();
            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateEventTest -= IntTest;

            ILRuntimeTest.TestFramework.DelegateTest test = new ILRuntimeTest.TestFramework.DelegateTest();
            test.IntDelegateEventTest2 += IntTest;
            test.TestEvent2();
            test.IntDelegateEventTest2 -= IntTest;
        }