示例#1
0
 /// <summary>
 /// Checks that interfaces do not contain ToString method declarations.
 /// </summary>
 /// <param name="mockedTypes">The types that are to be mocked.</param>
 private static void CheckInterfacesDoNotContainToStringMethodDeclaration(CompositeType mockedTypes)
 {
     foreach (var method in mockedTypes.GetMatchingMethods(new MethodNameMatcher("ToString"), false))
     {
         if (method.ReflectedType.IsInterface && method.GetParameters().Length == 0)
         {
             throw new ArgumentException("Interfaces must not contain a declaration for ToString().");
         }
     }
 }
示例#2
0
        /// <summary>
        /// Checks that interfaces do not contain ToString method declarations.
        /// </summary>
        /// <param name="mockedTypes">The types that are to be mocked.</param>
        private static void CheckInterfacesDoNotContainToStringMethodDeclaration(CompositeType mockedTypes)
        {
            foreach (var method in mockedTypes.GetMatchingMethods(new MethodNameMatcher("ToString"), false))
            {
                /* ^ */ var _typeInfo = method.DeclaringType.GetTypeInfo();                 /* [email protected] ^ */

                if (/* ^ */ _typeInfo.IsInterface && method.GetParameters().Length == 0 /* [email protected] ^ */)
                {
                    throw new ArgumentException("Interfaces must not contain a declaration for ToString().");
                }
            }
        }
示例#3
0
 public IList <MethodInfo> GetMethodsMatching(Matcher methodMatcher)
 {
     return(MockedTypes.GetMatchingMethods(methodMatcher, false));
 }