Example #1
0
        public void CtorFindSingleParameterNegativeLike()
        {
            var target = new CtorSingleParamOnly(null);
            const BindingFlags bflags = BindingFlags.Public | BindingFlags.Instance;

            //should not match any ctor where none match any param name and type matching query obj
            TestFind(target, new { arg1 = typeof(string) }, bflags, false);

            //should not match any ctor where none match any param typs in query obj
            TestFind(target, new[] { typeof(int) }, bflags, false);

            //should not match any ctor where none match any param name in query obj
            TestFind(target, new[] { "arg1" }, bflags, false);
        }
Example #2
0
        public void CtorFindSingleParameterPostiveLike()
        {
            var target = new CtorSingleParamOnly(null);
            const BindingFlags bflags = BindingFlags.Public | BindingFlags.Instance;

            //should match all ctor where at least one param name and type matching query obj
            TestFind(target, new { arg = typeof(string) }, bflags, true);

            //should match all ctor where at least one param type matches a type in query obj
            TestFind(target, new[] { typeof(string) }, bflags, true);

            //when given an array of strings should match ctors with parameters that contain matching names
            TestFind(target, new[] { "arg" }, bflags, true);
        }