2using System.Threading.Tasks;
4using Microsoft.VisualStudio.TestTools.UnitTesting;
15 var diagnostics = analyzer.SupportedDiagnostics;
16 Assert.AreEqual(1, diagnostics.Length);
18 var diagnostic = diagnostics[0];
19 Assert.AreEqual(Constants.AnalyzerIdentifiers.RefOrOutParameterInOperation, diagnostic.Id,
20 nameof(DiagnosticDescriptor.Id));
21 Assert.AreEqual(FindRefAndOutParametersInOperationsAnalyzerConstants.Title, diagnostic.Title.ToString(),
22 nameof(DiagnosticDescriptor.Title));
23 Assert.AreEqual(FindRefAndOutParametersInOperationsAnalyzerConstants.Message, diagnostic.MessageFormat.ToString(),
24 nameof(DiagnosticDescriptor.MessageFormat));
25 Assert.AreEqual(Constants.Categories.Usage, diagnostic.Category,
26 nameof(DiagnosticDescriptor.Category));
27 Assert.AreEqual(DiagnosticSeverity.Error, diagnostic.DefaultSeverity,
28 nameof(DiagnosticDescriptor.DefaultSeverity));
30 diagnostic.HelpLinkUri,
31 nameof(DiagnosticDescriptor.HelpLinkUri));
37 var code =
"public class A { }";
39 code, Array.Empty<
string>());
54 private void Fetch() { }
57 code, Array.Empty<
string>());
72 private void Fetch(string a) { }
75 code, Array.Empty<
string>());
90 private void Fetch(ref string a) { }
93 code,
new[] { Constants.AnalyzerIdentifiers.RefOrOutParameterInOperation });
108 private void Fetch(out string a) { a = string.Empty; }
111 code,
new[] { Constants.AnalyzerIdentifiers.RefOrOutParameterInOperation });
async Task AnalyzeWhenClassIsABusinessBaseAndHasOutParameter()
async Task AnalyzeWhenClassIsABusinessBaseAndHasNoParameters()
async Task AnalyzeWhenClassIsNotABusinessBase()
async Task AnalyzeWhenClassIsABusinessBaseAndHasParameterNotRefOrOut()
void VerifySupportedDiagnostics()
async Task AnalyzeWhenClassIsABusinessBaseAndHasRefParameter()