예제 #1
0
        public void GetMethodInfo_Action_NoArgs()
        {
            MethodInfo info = InfoHelper.GetMethodInfo(() => InfoHelperClass.StaticVoidMethod());

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "StaticVoidMethod");
        }
예제 #2
0
        public void GetMethodInfo_Func_Int()
        {
            MethodInfo info = InfoHelper.GetMethodInfo(() => InfoHelperClass.StaticIntMethod());

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "StaticIntMethod");
        }
예제 #3
0
        public void GetMethodInfo_Action_OutArgsHelper()
        {
            MethodInfo info = InfoHelper.GetMethodInfo(
                () => InfoHelperClass.StaticOutMethod(ref InfoHelper <int> .RefOrOut, out InfoHelper <int> .RefOrOut));

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "StaticOutMethod");
        }
예제 #4
0
        public void GetMethodInfo_Action_OutArgs()
        {
            int        a = 0, b;
            MethodInfo info = InfoHelper.GetMethodInfo(() => InfoHelperClass.StaticOutMethod(ref a, out b));

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "StaticOutMethod");
        }
예제 #5
0
        public void GetParameterInfo_Static_SecondArg()
        {
            ParameterInfo info = InfoHelper.GetParameterInfo <int>(p => InfoHelperClass.StaticStringArgsMethod(default(string), p));

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "iarg");
            Assert.AreEqual(info.ParameterType, typeof(int));
        }
예제 #6
0
        public void GetParameterInfo_Static_FirstArg()
        {
            ParameterInfo info = InfoHelper.GetParameterInfo <string>(p => InfoHelperClass.StaticStringArgsMethod(p, default(int)));

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "sarg");
            Assert.AreEqual(info.ParameterType, typeof(string));
        }
예제 #7
0
        public void GetParameterInfo_Static_Out()
        {
            ParameterInfo info = InfoHelper.GetParameterInfo <int>(p => InfoHelperClass.StaticOutMethod(ref InfoHelper <int> .RefOrOut, out InfoHelper <int> .Parameter));

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "b");
            Assert.AreEqual(info.ParameterType, typeof(int).MakeByRefType());
        }
예제 #8
0
        public void GetMethodInfo_Action_Args()
        {
            MethodInfo info = InfoHelper.GetMethodInfo(
                () => InfoHelperClass.StaticVoidArgsMethod(default(string), default(int)));

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "StaticVoidArgsMethod");
        }
예제 #9
0
        public void GetParameterInfo_Static_InvalidThrowIfNotFoundThrows()
        {
            ParameterInfo info = InfoHelper.GetParameterInfo <int>(p => InfoHelperClass.StaticVoidMethod(), true);

            Assert.Fail("Didn't throw");
        }
예제 #10
0
        public void GetParameterInfo_Static_Invalid_UsedMultiple()
        {
            ParameterInfo info = InfoHelper.GetParameterInfo <int>(p => InfoHelperClass.StaticSameArgsMethod(p, p, p));

            Assert.Fail("Didn't throw");
        }
예제 #11
0
        public void GetParameterInfo_Static_Invalid_NotUsed()
        {
            ParameterInfo info = InfoHelper.GetParameterInfo <int>(p => InfoHelperClass.StaticVoidMethod());

            Assert.IsNull(info);
        }