-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
129 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace BusinessCentral.LinterCop.Test; | ||
|
||
public class Rule0023 | ||
{ | ||
private string _testCaseDir = ""; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
_testCaseDir = Path.Combine(Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName, | ||
"TestCases", "Rule0023"); | ||
} | ||
|
||
//TODO: Resolve "There is no issue reported for LC0023 at [96...107]." for these tests. | ||
// [Test] | ||
// [TestCase("BrickIsMissing")] | ||
// [TestCase("DropDownIsMissing")] | ||
// [TestCase("FieldgroupsIsMissing")] | ||
// public async Task HasDiagnostic(string testCase) | ||
// { | ||
// var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "HasDiagnostic", $"{testCase}.al")) | ||
// .ConfigureAwait(false); | ||
|
||
// var fixture = RoslynFixtureFactory.Create<BuiltInMethodImplementThroughCodeunit>(); | ||
// fixture.HasDiagnostic(code, DiagnosticDescriptors.Rule0023AlwaysSpecifyFieldgroups.Id); | ||
// } | ||
|
||
[Test] | ||
[TestCase("HasBrickAndDropDown")] | ||
public async Task NoDiagnostic(string testCase) | ||
{ | ||
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "NoDiagnostic", $"{testCase}.al")) | ||
.ConfigureAwait(false); | ||
|
||
var fixture = RoslynFixtureFactory.Create<BuiltInMethodImplementThroughCodeunit>(); | ||
fixture.NoDiagnosticAtMarker(code, DiagnosticDescriptors.Rule0023AlwaysSpecifyFieldgroups.Id); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
BusinessCentral.LinterCop.Test/TestCases/Rule0023/HasDiagnostic/BrickIsMissing.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
table 50100 MyTable | ||
{ | ||
fields | ||
{ | ||
field(1; MyField; Integer) { } | ||
} | ||
|
||
[|fieldgroups|] | ||
{ | ||
fieldgroup(DropDown; MyField) { } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
BusinessCentral.LinterCop.Test/TestCases/Rule0023/HasDiagnostic/DropDownIsMissing.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
table 50100 MyTable | ||
{ | ||
fields | ||
{ | ||
field(1; MyField; Integer) { } | ||
} | ||
|
||
[|fieldgroups|] | ||
{ | ||
fieldgroup(Brick; MyField) { } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
BusinessCentral.LinterCop.Test/TestCases/Rule0023/HasDiagnostic/FieldgroupsIsMissing.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
table 50100 MyTable | ||
{ | ||
fields | ||
{ | ||
field(1; MyField; Integer) { } | ||
} | ||
|
||
keys | ||
{ | ||
key(Key1; MyField) { } | ||
} | ||
[| |] | ||
} |
13 changes: 13 additions & 0 deletions
13
BusinessCentral.LinterCop.Test/TestCases/Rule0023/NoDiagnostic/HasBrickAndDropDown.al
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
table 50100 MyTable | ||
{ | ||
fields | ||
{ | ||
field(1; MyField; Integer) { } | ||
} | ||
|
||
[|fieldgroups|] | ||
{ | ||
fieldgroup(Brick; MyField) { } | ||
fieldgroup(DropDown; MyField) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters