Example #1
0
        private void OnNewType(TypeFacts typeFacts)
        {
            Type type = typeFacts.TheType;

            MethodInfo[] methods = type.GetMethods(
                BindingFlags.Static | BindingFlags.Instance |
                BindingFlags.Public | BindingFlags.NonPublic);
            foreach (MethodInfo method in methods)
            {
                if (method.GetCustomOrInjectedAttribute(typeof(IAssumeCalled)) != null ||
                    method.Name.Contains('<')) // Anonymous methods don't give a chance to attach an attribute.
                {
                    AddMethod(method);
                }
            }
            foreach (Type itype in type.GetInterfaces())
            {
                AddType(itype);
            }
            Type btype = type.BaseType;

            while (btype != null && !btype.Equals(type))
            {
                AddType(btype);
                type  = btype;
                btype = type.BaseType;
            }
        }
Example #2
0
        private void OnNewType(TypeFacts typeFacts)
        {
            Type type = typeFacts.TheType;

            MethodInfo[] methods = type.GetMethods(
                BindingFlags.Static | BindingFlags.Instance |
                BindingFlags.Public | BindingFlags.NonPublic);
            foreach (MethodInfo method in methods)
            {
                if (method.GetCustomOrInjectedAttribute(typeof(IAssumeCalled)) != null ||
                    method.Name.Contains('<')) // Anonymous methods don't give a chance to attach an attribute.
                {
                    AddMethod(method);
                }
            }
            foreach (Type itype in type.GetInterfaces())
                AddType(itype);
            Type btype = type.BaseType;
            while (btype != null && !btype.Equals(type))
            {
                AddType(btype);
                type = btype;
                btype = type.BaseType;
            }
        }