-
Notifications
You must be signed in to change notification settings - Fork 31
/
Rule0071.cs
43 lines (37 loc) · 1.46 KB
/
Rule0071.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace BusinessCentral.LinterCop.Test;
public class Rule0071
{
private string _testCaseDir = "";
[SetUp]
public void Setup()
{
_testCaseDir = Path.Combine(Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName,
"TestCases", "Rule0071");
}
[Test]
[TestCase("Assignment")]
[TestCase("Invocation")]
[TestCase("Handled")]
[TestCase("PrecedingExitOnAssignment")]
[TestCase("PrecedingExitOnInvocation")]
public async Task HasDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "HasDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);
var fixture = RoslynFixtureFactory.Create<Rule0071DoNotSetIsHandledToFalse>();
fixture.HasDiagnostic(code, DiagnosticDescriptors.Rule0071DoNotSetIsHandledToFalse.Id);
}
[Test]
[TestCase("Assignment")]
[TestCase("Invocation")]
[TestCase("NoEventSubscriberParameterReference")]
[TestCase("PrecedingExitOnAssignment")]
[TestCase("PrecedingExitOnInvocation")]
public async Task NoDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "NoDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);
var fixture = RoslynFixtureFactory.Create<Rule0071DoNotSetIsHandledToFalse>();
fixture.NoDiagnosticAtMarker(code, DiagnosticDescriptors.Rule0071DoNotSetIsHandledToFalse.Id);
}
}