private IMethod FindAssertionMethod([NotNull] string assertionMethodName, [NotNull] IExpressionType parameterType, [NotNull] IPsiModule module) { var symbolScope = module.GetPsiServices().Symbols.GetSymbolScope(module, true, true); IClass typeDecl = null; if (this.CachedAssertClassTypeName != null) { typeDecl = symbolScope.GetTypeElementByCLRName(this.CachedAssertClassTypeName) as IClass; } else { var candidates = symbolScope.GetElementsByShortName(AssertTypeName).OfType <IClass>().Where(c => c.CanBeVisibleToSolution()).ToArray(); if (candidates.Length == 1) { typeDecl = candidates[0]; } if (typeDecl != null) { this.CachedAssertClassTypeName = typeDecl.GetClrName(); } } return(typeDecl? .EnumerateMembers(assertionMethodName, true) .OfType <IMethod>() .FirstOrDefault(m => m.Parameters.Count > 1 && (m.Parameters[0].Type.IsOpenType || parameterType.IsImplicitlyConvertibleTo(m.Parameters[0].Type, module.GetTypeConversionRule())))); }