Moq.Analyzers.MoqMethodDescriptor.DoesShortMethodMatch(string)

Here are the examples of the csharp api Moq.Analyzers.MoqMethodDescriptor.DoesShortMethodMatch(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : MoqMethodDescriptor.cs
with BSD 3-Clause "New" or "Revised" License
from Litee

public bool IsMoqMethod(SemanticModel semanticModel, MemberAccessExpressionSyntax method)
        {
            var methodName = method?.Name.ToString();

            // First fast check before walking semantic model
            if (DoesShortMethodMatch(methodName) == false) return false;

            var symbolInfo = semanticModel.GetSymbolInfo(method);
            if (symbolInfo.CandidateReason == CandidateReason.OverloadResolutionFailure)
            {
                return symbolInfo.CandidateSymbols.OfType<IMethodSymbol>()
                    .Any(s => this.FullMethodNamePattern.IsMatch(s.ToString()));
            }
            else if (symbolInfo.CandidateReason == CandidateReason.None)
            {
                // TODO: Replace regex with something more elegant
                return symbolInfo.Symbol is IMethodSymbol &&
                       this.FullMethodNamePattern.IsMatch(symbolInfo.Symbol.ToString());
            }

            return false;
        }