public void GetMethodInfo_Action_NoArgs()
        {
            MethodInfo info = InfoHelper.GetMethodInfo(() => InfoHelperClass.StaticVoidMethod());

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

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "StaticIntMethod");
        }
        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");
        }
        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");
        }
        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));
        }
        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));
        }
        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());
        }
        public void GetMethodInfo_Action_Args()
        {
            MethodInfo info = InfoHelper.GetMethodInfo(
                () => InfoHelperClass.StaticVoidArgsMethod(default(string), default(int)));

            Assert.IsNotNull(info);
            Assert.AreEqual(info.Name, "StaticVoidArgsMethod");
        }
        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);
        }