private static DiagnosticResult GetExpectedDiagnostic(int line, int column, string analyzerTypeName, string violatingIndirectTypesOpt, string violatingTypes) { var result = new DiagnosticResult(DiagnosticIds.DoNotUseTypesFromAssemblyRuleId, DiagnosticHelpers.DefaultDiagnosticSeverity) .WithLocation(line, column); if (violatingIndirectTypesOpt is null) { return(result .WithMessageFormat(CodeAnalysisDiagnosticsResources.DoNotUseTypesFromAssemblyRuleDirectMessage) .WithArguments(analyzerTypeName, violatingTypes)); } else { return(result .WithMessageFormat(CodeAnalysisDiagnosticsResources.DoNotUseTypesFromAssemblyRuleIndirectMessage) .WithArguments(analyzerTypeName, violatingIndirectTypesOpt, violatingTypes)); } }