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.CompleteInExecuteAsync, diagnostic.Id,
20 nameof(DiagnosticDescriptor.Id));
21 Assert.AreEqual(IsCompleteCalledInAsynchronousBusinessRuleConstants.Title, diagnostic.Title.ToString(),
22 nameof(DiagnosticDescriptor.Title));
23 Assert.AreEqual(IsCompleteCalledInAsynchronousBusinessRuleConstants.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>());
47using System.Threading.Tasks;
49public class A : BusinessRuleAsync
51 protected override Task ExecuteAsync(IRuleContext context) { }
54 code, Array.Empty<
string>());
62using System.Threading.Tasks;
64public class A : BusinessRuleAsync
66 protected override Task ExecuteAsync(IRuleContext context)
72 code,
new[] { Constants.AnalyzerIdentifiers.CompleteInExecuteAsync });
80using System.Threading.Tasks;
82public class A : BusinessRuleAsync
84 protected override Task ExecuteAsync(IRuleContext context)
86 var c = nameof(context);
91 code,
new[] { Constants.AnalyzerIdentifiers.CompleteInExecuteAsync });
async Task AnalyzeWhenClassIsABusinessRuleAndCallsComplete()
async Task AnalyzeWhenClassIsABusinessRuleAndDoesNotCallComplete()
async Task AnalyzeWhenClassIsABusinessRuleAndCallsCompleteAndNameof()
void VerifySupportedDiagnostics()
async Task AnalyzeWhenClassIsNotABusinessRule()