/// <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()."); } } }
/// <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()."); } } }
public IList <MethodInfo> GetMethodsMatching(Matcher methodMatcher) { return(MockedTypes.GetMatchingMethods(methodMatcher, false)); }