private void AnalyzePartialSubstitute(SubstituteContext <TInvocationExpressionSyntax> substituteContext) { if (AnalyzeProxies(substituteContext)) { return; } var proxyType = SubstituteProxyAnalysis.GetActualProxyTypeSymbol(substituteContext); if (proxyType == null) { return; } if (AnalyzeTypeKind(substituteContext, proxyType)) { return; } if (AnalyzeTypeAccessability(substituteContext, proxyType)) { return; } if (proxyType.TypeKind != TypeKind.Class) { return; } var constructorContext = SubstituteConstructorAnalysis.CollectConstructorContext(substituteContext, proxyType); AnalyzeConstructor(substituteContext, constructorContext); }
private bool AnalyzeProxies(SubstituteContext <TInvocationExpressionSyntax> substituteContext) { var proxies = SubstituteProxyAnalysis.GetProxySymbols(substituteContext).ToList(); var classProxies = proxies.Where(proxy => proxy.TypeKind == TypeKind.Class).Distinct(); if (classProxies.Count() > 1) { var diagnostic = Diagnostic.Create( DiagnosticDescriptorsProvider.SubstituteMultipleClasses, substituteContext.InvocationExpression.GetLocation()); substituteContext.SyntaxNodeAnalysisContext.ReportDiagnostic(diagnostic); return(true); } return(false); }