-
Notifications
You must be signed in to change notification settings - Fork 31
/
Rule0003.cs
35 lines (29 loc) · 1.2 KB
/
Rule0003.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
namespace BusinessCentral.LinterCop.Test;
public class Rule0003
{
private string _testCaseDir = "";
[SetUp]
public void Setup()
{
_testCaseDir = Path.Combine(Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName,
"TestCases", "Rule0003");
}
[Test]
[TestCase("1")]
public async Task HasDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "HasDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);
var fixture = RoslynFixtureFactory.Create<Rule0003DoNotUseObjectIDsInVariablesOrProperties>();
fixture.HasDiagnostic(code, DiagnosticDescriptors.Rule0003DoNotUseObjectIDsInVariablesOrProperties.Id);
}
[Test]
[TestCase("1")]
public async Task NoDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "NoDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);
var fixture = RoslynFixtureFactory.Create<Rule0003DoNotUseObjectIDsInVariablesOrProperties>();
fixture.NoDiagnosticAtMarker(code, DiagnosticDescriptors.Rule0003DoNotUseObjectIDsInVariablesOrProperties.Id);
}
}