diff --git a/.github/instructions/ac0013-field-groups-required.instructions.md b/.github/instructions/ac0013-field-groups-required.instructions.md index 29f0516e..2fcbce0f 100644 --- a/.github/instructions/ac0013-field-groups-required.instructions.md +++ b/.github/instructions/ac0013-field-groups-required.instructions.md @@ -49,7 +49,7 @@ Uses `RegisterCompilationStartAction` to discover which tables are referenced by ## Test coverage -Tests are commented out (TODO: `WithRuleSetPath` in RoslynTestKit needed since rule is `isEnabledByDefault: false`). +The rule is `isEnabledByDefault: false`, so the test class enables it via a co-located `FieldGroupsRequired.ruleset.json` fixture passed through `AnalyzerTestFixtureConfig.RuleSetPath` (requires RoslynTestKit that applies the ruleset to the compilation). -**HasDiagnostic (3 cases, commented out):** BrickIsMissing, DropDownIsMissing, TemporaryTable (referenced by page). +**HasDiagnostic (3 cases):** BrickIsMissing, DropDownIsMissing, TemporaryTable (referenced by page). **NoDiagnostic (2 cases):** HasBrickAndDropDown, TemporaryTable (no page reference). diff --git a/.github/instructions/testing.instructions.md b/.github/instructions/testing.instructions.md index 55b45188..6414fbd8 100644 --- a/.github/instructions/testing.instructions.md +++ b/.github/instructions/testing.instructions.md @@ -333,6 +333,40 @@ public async Task NoDiagnosticWithTargetOnPrem(string testCase) This requires `using Microsoft.Dynamics.Nav.CodeAnalysis;` for `CompilationOptions` and `CompilationTarget`. +## Testing rules that are `isEnabledByDefault: false` + +Rules declared with `isEnabledByDefault: false` never run in tests unless a ruleset explicitly enables them. Inject a co-located ruleset JSON fixture via `AnalyzerTestFixtureConfig.RuleSetPath` (requires RoslynTestKit 1.4.0+, which loads the ruleset and applies it to the compilation's diagnostic options). + +Add a `{RuleName}.ruleset.json` next to the test class in its `Rules/{RuleName}/` folder: + +```json +{ + "name": "Enable AC0013", + "description": "Enables AC0013 for tests.", + "rules": [ { "id": "AC0013", "action": "Info" } ] +} +``` + +Set `action` to the rule's default severity (`Info`, `Warning`, etc.) to enable it. Then wire it in `Setup` (compute `_testCasePath` **before** creating the fixture, since the path feeds `RuleSetPath`): + +```csharp +[SetUp] +public void Setup() +{ + _testCasePath = Path.Combine( + Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName, + Path.Combine("Rules", nameof(MyRule))); + + _fixture = RoslynFixtureFactory.Create( + new AnalyzerTestFixtureConfig + { + RuleSetPath = Path.Combine(_testCasePath, $"{nameof(MyRule)}.ruleset.json") + }); +} +``` + +The ruleset JSON resolves via the same source-tree absolute path as the `.al` fixtures, so no `CopyToOutputDirectory` is required. For code-fix tests, pass `RuleSetPath` on `CodeFixTestFixtureConfig` too. + ## Naming Conventions | Element | Convention | Example | diff --git a/src/ALCops.ApplicationCop.Test/ALCops.ApplicationCop.Test.csproj b/src/ALCops.ApplicationCop.Test/ALCops.ApplicationCop.Test.csproj index 01c2e33b..c8545bda 100644 --- a/src/ALCops.ApplicationCop.Test/ALCops.ApplicationCop.Test.csproj +++ b/src/ALCops.ApplicationCop.Test/ALCops.ApplicationCop.Test.csproj @@ -60,12 +60,12 @@ - + - + True diff --git a/src/ALCops.ApplicationCop.Test/Rules/FieldGroupsRequired/FieldGroupsRequired.cs b/src/ALCops.ApplicationCop.Test/Rules/FieldGroupsRequired/FieldGroupsRequired.cs index 24d10c42..e1a56662 100644 --- a/src/ALCops.ApplicationCop.Test/Rules/FieldGroupsRequired/FieldGroupsRequired.cs +++ b/src/ALCops.ApplicationCop.Test/Rules/FieldGroupsRequired/FieldGroupsRequired.cs @@ -10,26 +10,29 @@ public class FieldGroupsRequired : NavCodeAnalysisBase [SetUp] public void Setup() { - _fixture = RoslynFixtureFactory.Create(); - _testCasePath = Path.Combine( Directory.GetParent( Environment.CurrentDirectory)!.Parent!.Parent!.FullName, Path.Combine("Rules", nameof(FieldGroupsRequired))); + + _fixture = RoslynFixtureFactory.Create( + new AnalyzerTestFixtureConfig + { + RuleSetPath = Path.Combine(_testCasePath, $"{nameof(FieldGroupsRequired)}.ruleset.json") + }); } - //TODO: Expose .WithRuleSetPath in RoslynTestKit, so we can enable/disable diagnostics in tests - // [Test] - // [TestCase("BrickIsMissing")] - // [TestCase("DropDownIsMissing")] - // [TestCase("TemporaryTable")] - // public async Task HasDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("BrickIsMissing")] + [TestCase("DropDownIsMissing")] + [TestCase("TemporaryTable")] + public async Task HasDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.FieldGroupsRequired); - // } + _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.FieldGroupsRequired); + } [Test] [TestCase("HasBrickAndDropDown")] diff --git a/src/ALCops.ApplicationCop.Test/Rules/FieldGroupsRequired/FieldGroupsRequired.ruleset.json b/src/ALCops.ApplicationCop.Test/Rules/FieldGroupsRequired/FieldGroupsRequired.ruleset.json new file mode 100644 index 00000000..a9581942 --- /dev/null +++ b/src/ALCops.ApplicationCop.Test/Rules/FieldGroupsRequired/FieldGroupsRequired.ruleset.json @@ -0,0 +1,10 @@ +{ + "name": "Enable AC0013", + "description": "Enables the default-disabled FieldGroupsRequired rule so it can be tested.", + "rules": [ + { + "id": "AC0013", + "action": "Info" + } + ] +} diff --git a/src/ALCops.ApplicationCop.Test/Rules/LabelLockedMustHaveTokSuffix/LabelLockedMustHaveTokSuffix.cs b/src/ALCops.ApplicationCop.Test/Rules/LabelLockedMustHaveTokSuffix/LabelLockedMustHaveTokSuffix.cs index 9b6041ec..30b45e19 100644 --- a/src/ALCops.ApplicationCop.Test/Rules/LabelLockedMustHaveTokSuffix/LabelLockedMustHaveTokSuffix.cs +++ b/src/ALCops.ApplicationCop.Test/Rules/LabelLockedMustHaveTokSuffix/LabelLockedMustHaveTokSuffix.cs @@ -10,33 +10,36 @@ public class LabelLockedMustHaveTokSuffix : NavCodeAnalysisBase [SetUp] public void Setup() { - _fixture = RoslynFixtureFactory.Create(); - _testCasePath = Path.Combine( Directory.GetParent( Environment.CurrentDirectory)!.Parent!.Parent!.FullName, Path.Combine("Rules", nameof(LabelLockedMustHaveTokSuffix))); + + _fixture = RoslynFixtureFactory.Create( + new AnalyzerTestFixtureConfig + { + RuleSetPath = Path.Combine(_testCasePath, $"{nameof(LabelLockedMustHaveTokSuffix)}.ruleset.json") + }); } - //TODO: Expose .WithRuleSetPath in RoslynTestKit, so we can enable/disable diagnostics in tests - // [Test] - // [TestCase("Label")] - // public async Task HasDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("Label")] + public async Task HasDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.LabelLockedMustHaveTokSuffix); - // } + _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.LabelLockedMustHaveTokSuffix); + } - // [Test] - // [TestCase("Label")] - // public async Task NoDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(NoDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("Label")] + public async Task NoDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(NoDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.NoDiagnosticAtAllMarkers(code, DiagnosticIds.LabelLockedMustHaveTokSuffix); - // } + _fixture.NoDiagnosticAtAllMarkers(code, DiagnosticIds.LabelLockedMustHaveTokSuffix); + } } } \ No newline at end of file diff --git a/src/ALCops.ApplicationCop.Test/Rules/LabelLockedMustHaveTokSuffix/LabelLockedMustHaveTokSuffix.ruleset.json b/src/ALCops.ApplicationCop.Test/Rules/LabelLockedMustHaveTokSuffix/LabelLockedMustHaveTokSuffix.ruleset.json new file mode 100644 index 00000000..b6704360 --- /dev/null +++ b/src/ALCops.ApplicationCop.Test/Rules/LabelLockedMustHaveTokSuffix/LabelLockedMustHaveTokSuffix.ruleset.json @@ -0,0 +1,10 @@ +{ + "name": "Enable AC0021", + "description": "Enables the default-disabled LabelLockedMustHaveTokSuffix rule so it can be tested.", + "rules": [ + { + "id": "AC0021", + "action": "Info" + } + ] +} diff --git a/src/ALCops.ApplicationCop.Test/Rules/TableDataPerCompanyDeclaration/TableDataPerCompanyDeclaration.cs b/src/ALCops.ApplicationCop.Test/Rules/TableDataPerCompanyDeclaration/TableDataPerCompanyDeclaration.cs index 52500298..967d47c6 100644 --- a/src/ALCops.ApplicationCop.Test/Rules/TableDataPerCompanyDeclaration/TableDataPerCompanyDeclaration.cs +++ b/src/ALCops.ApplicationCop.Test/Rules/TableDataPerCompanyDeclaration/TableDataPerCompanyDeclaration.cs @@ -10,34 +10,37 @@ public class TableDataPerCompanyDeclaration : NavCodeAnalysisBase [SetUp] public void Setup() { - _fixture = RoslynFixtureFactory.Create(); - _testCasePath = Path.Combine( Directory.GetParent( Environment.CurrentDirectory)!.Parent!.Parent!.FullName, Path.Combine("Rules", nameof(TableDataPerCompanyDeclaration))); + + _fixture = RoslynFixtureFactory.Create( + new AnalyzerTestFixtureConfig + { + RuleSetPath = Path.Combine(_testCasePath, $"{nameof(TableDataPerCompanyDeclaration)}.ruleset.json") + }); } - //TODO: Expose .WithRuleSetPath in RoslynTestKit, so we can enable/disable diagnostics in tests - // [Test] - // [TestCase("DataPerCompanyPropertyMissing")] - // public async Task HasDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("DataPerCompanyPropertyMissing")] + public async Task HasDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.TableDataPerCompanyDeclaration); - // } + _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.TableDataPerCompanyDeclaration); + } - // [Test] - // [TestCase("DataPerCompanyFalse")] - // [TestCase("DataPerCompanyTrue")] - // public async Task NoDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(NoDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("DataPerCompanyFalse")] + [TestCase("DataPerCompanyTrue")] + public async Task NoDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(NoDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.NoDiagnosticAtAllMarkers(code, DiagnosticIds.TableDataPerCompanyDeclaration); - // } + _fixture.NoDiagnosticAtAllMarkers(code, DiagnosticIds.TableDataPerCompanyDeclaration); + } } } \ No newline at end of file diff --git a/src/ALCops.ApplicationCop.Test/Rules/TableDataPerCompanyDeclaration/TableDataPerCompanyDeclaration.ruleset.json b/src/ALCops.ApplicationCop.Test/Rules/TableDataPerCompanyDeclaration/TableDataPerCompanyDeclaration.ruleset.json new file mode 100644 index 00000000..2eb226c5 --- /dev/null +++ b/src/ALCops.ApplicationCop.Test/Rules/TableDataPerCompanyDeclaration/TableDataPerCompanyDeclaration.ruleset.json @@ -0,0 +1,10 @@ +{ + "name": "Enable AC0008", + "description": "Enables the default-disabled TableDataPerCompanyDeclaration rule so it can be tested.", + "rules": [ + { + "id": "AC0008", + "action": "Info" + } + ] +} diff --git a/src/ALCops.DocumentationCop.Test/ALCops.DocumentationCop.Test.csproj b/src/ALCops.DocumentationCop.Test/ALCops.DocumentationCop.Test.csproj index 3fbae128..40586d35 100644 --- a/src/ALCops.DocumentationCop.Test/ALCops.DocumentationCop.Test.csproj +++ b/src/ALCops.DocumentationCop.Test/ALCops.DocumentationCop.Test.csproj @@ -60,12 +60,12 @@ - + - diff --git a/src/ALCops.FormattingCop.Test/ALCops.FormattingCop.Test.csproj b/src/ALCops.FormattingCop.Test/ALCops.FormattingCop.Test.csproj index 3471a229..a7947d8b 100644 --- a/src/ALCops.FormattingCop.Test/ALCops.FormattingCop.Test.csproj +++ b/src/ALCops.FormattingCop.Test/ALCops.FormattingCop.Test.csproj @@ -60,12 +60,12 @@ - + - diff --git a/src/ALCops.LinterCop.Test/ALCops.LinterCop.Test.csproj b/src/ALCops.LinterCop.Test/ALCops.LinterCop.Test.csproj index 24fa1f1c..7e65978b 100644 --- a/src/ALCops.LinterCop.Test/ALCops.LinterCop.Test.csproj +++ b/src/ALCops.LinterCop.Test/ALCops.LinterCop.Test.csproj @@ -60,12 +60,12 @@ - + - diff --git a/src/ALCops.PlatformCop.Test/ALCops.PlatformCop.Test.csproj b/src/ALCops.PlatformCop.Test/ALCops.PlatformCop.Test.csproj index 57e479ef..65964a68 100644 --- a/src/ALCops.PlatformCop.Test/ALCops.PlatformCop.Test.csproj +++ b/src/ALCops.PlatformCop.Test/ALCops.PlatformCop.Test.csproj @@ -60,12 +60,12 @@ - + - diff --git a/src/ALCops.PlatformCop.Test/Rules/AccessPropertyExplicitlySet/AccessPropertyExplicitlySet.cs b/src/ALCops.PlatformCop.Test/Rules/AccessPropertyExplicitlySet/AccessPropertyExplicitlySet.cs index e45c6e42..aa77cda5 100644 --- a/src/ALCops.PlatformCop.Test/Rules/AccessPropertyExplicitlySet/AccessPropertyExplicitlySet.cs +++ b/src/ALCops.PlatformCop.Test/Rules/AccessPropertyExplicitlySet/AccessPropertyExplicitlySet.cs @@ -10,34 +10,37 @@ public class AccessPropertyExplicitlySet : NavCodeAnalysisBase [SetUp] public void Setup() { - _fixture = RoslynFixtureFactory.Create(); - _testCasePath = Path.Combine( Directory.GetParent( Environment.CurrentDirectory)!.Parent!.Parent!.FullName, Path.Combine("Rules", nameof(AccessPropertyExplicitlySet))); + + _fixture = RoslynFixtureFactory.Create( + new AnalyzerTestFixtureConfig + { + RuleSetPath = Path.Combine(_testCasePath, $"{nameof(AccessPropertyExplicitlySet)}.ruleset.json") + }); } - //TODO: Expose .WithRuleSetPath in RoslynTestKit, so we can enable/disable diagnostics in tests - // [Test] - // [TestCase("CodeunitObject")] - // public async Task HasDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("CodeunitObject")] + public async Task HasDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.AccessPropertyExplicitlySet); - // } + _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.AccessPropertyExplicitlySet); + } - // [Test] - // [TestCase("CodeunitObject")] - // [TestCase("TableFieldWithoutAccess")] - // public async Task NoDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(NoDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("CodeunitObject")] + [TestCase("TableFieldWithoutAccess")] + public async Task NoDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(NoDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.NoDiagnosticAtAllMarkers(code, DiagnosticIds.AccessPropertyExplicitlySet); - // } + _fixture.NoDiagnosticAtAllMarkers(code, DiagnosticIds.AccessPropertyExplicitlySet); + } } } \ No newline at end of file diff --git a/src/ALCops.PlatformCop.Test/Rules/AccessPropertyExplicitlySet/AccessPropertyExplicitlySet.ruleset.json b/src/ALCops.PlatformCop.Test/Rules/AccessPropertyExplicitlySet/AccessPropertyExplicitlySet.ruleset.json new file mode 100644 index 00000000..67a5816c --- /dev/null +++ b/src/ALCops.PlatformCop.Test/Rules/AccessPropertyExplicitlySet/AccessPropertyExplicitlySet.ruleset.json @@ -0,0 +1,10 @@ +{ + "name": "Enable PC0006", + "description": "Enables the default-disabled AccessPropertyExplicitlySet rule so it can be tested.", + "rules": [ + { + "id": "PC0006", + "action": "Warning" + } + ] +} diff --git a/src/ALCops.PlatformCop.Test/Rules/ExtensiblePropertyExplicitlySet/ExtensiblePropertyExplicitlySet.cs b/src/ALCops.PlatformCop.Test/Rules/ExtensiblePropertyExplicitlySet/ExtensiblePropertyExplicitlySet.cs index d902852d..74807836 100644 --- a/src/ALCops.PlatformCop.Test/Rules/ExtensiblePropertyExplicitlySet/ExtensiblePropertyExplicitlySet.cs +++ b/src/ALCops.PlatformCop.Test/Rules/ExtensiblePropertyExplicitlySet/ExtensiblePropertyExplicitlySet.cs @@ -12,59 +12,61 @@ public class ExtensiblePropertyExplicitlySet : NavCodeAnalysisBase [SetUp] public void Setup() { - _fixture = RoslynFixtureFactory.Create(); - _testCasePath = Path.Combine( Directory.GetParent( Environment.CurrentDirectory)!.Parent!.Parent!.FullName, Path.Combine("Rules", nameof(ExtensiblePropertyExplicitlySet))); + + _fixture = RoslynFixtureFactory.Create( + new AnalyzerTestFixtureConfig + { + RuleSetPath = Path.Combine(_testCasePath, $"{nameof(ExtensiblePropertyExplicitlySet)}.ruleset.json") + }); } - //TODO: Expose .WithRuleSetPath in RoslynTestKit, so we can enable/disable diagnostics in tests - // [Test] - // [TestCase("EnumObject")] - // [TestCase("PageObject")] - // [TestCase("ReportObject")] - // [TestCase("TableObject")] - // public async Task HasDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("PageObject")] + [TestCase("ReportObject")] + [TestCase("TableObject")] + public async Task HasDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.ExtensiblePropertyExplicitlySet); - // } + _fixture.HasDiagnosticAtAllMarkers(code, DiagnosticIds.ExtensiblePropertyExplicitlySet); + } - // [Test] - // [TestCase("PageObject")] - // [TestCase("TableObject")] - // public async Task NoDiagnostic(string testCase) - // { - // var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(NoDiagnostic), $"{testCase}.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("PageObject")] + [TestCase("TableObject")] + public async Task NoDiagnostic(string testCase) + { + var code = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(NoDiagnostic), $"{testCase}.al")) + .ConfigureAwait(false); - // _fixture.NoDiagnosticAtAllMarkers(code, DiagnosticIds.ExtensiblePropertyExplicitlySet); - // } + _fixture.NoDiagnosticAtAllMarkers(code, DiagnosticIds.ExtensiblePropertyExplicitlySet); + } - // [Test] - // [TestCase("EnumObject")] - // [TestCase("PageObject")] - // [TestCase("ReportObject")] - // [TestCase("TableObject")] - // public async Task HasFix(string testCase) - // { - // var currentCode = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasFix), testCase, "current.al")) - // .ConfigureAwait(false); + [Test] + [TestCase("PageObject")] + [TestCase("ReportObject")] + [TestCase("TableObject")] + public async Task HasFix(string testCase) + { + var currentCode = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasFix), testCase, "current.al")) + .ConfigureAwait(false); - // var expectedCode = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasFix), testCase, "expected.al")) - // .ConfigureAwait(false); + var expectedCode = await File.ReadAllTextAsync(Path.Combine(_testCasePath, nameof(HasFix), testCase, "expected.al")) + .ConfigureAwait(false); - // var fixture = RoslynFixtureFactory.Create( - // new CodeFixTestFixtureConfig - // { - // AdditionalAnalyzers = [_analyzer] - // }); + var fixture = RoslynFixtureFactory.Create( + new CodeFixTestFixtureConfig + { + AdditionalAnalyzers = [_analyzer], + RuleSetPath = Path.Combine(_testCasePath, $"{nameof(ExtensiblePropertyExplicitlySet)}.ruleset.json") + }); - // fixture.TestCodeFix(currentCode, expectedCode, DiagnosticDescriptors.ExtensiblePropertyExplicitlySet); - // } + fixture.TestCodeFix(currentCode, expectedCode, DiagnosticDescriptors.ExtensiblePropertyExplicitlySet); + } } } \ No newline at end of file diff --git a/src/ALCops.PlatformCop.Test/Rules/ExtensiblePropertyExplicitlySet/ExtensiblePropertyExplicitlySet.ruleset.json b/src/ALCops.PlatformCop.Test/Rules/ExtensiblePropertyExplicitlySet/ExtensiblePropertyExplicitlySet.ruleset.json new file mode 100644 index 00000000..2039ab40 --- /dev/null +++ b/src/ALCops.PlatformCop.Test/Rules/ExtensiblePropertyExplicitlySet/ExtensiblePropertyExplicitlySet.ruleset.json @@ -0,0 +1,10 @@ +{ + "name": "Enable PC0005", + "description": "Enables the default-disabled ExtensiblePropertyExplicitlySet rule so it can be tested.", + "rules": [ + { + "id": "PC0005", + "action": "Warning" + } + ] +} diff --git a/src/ALCops.TestAutomationCop.Test/ALCops.TestAutomationCop.Test.csproj b/src/ALCops.TestAutomationCop.Test/ALCops.TestAutomationCop.Test.csproj index 46e0ef01..1356eba2 100644 --- a/src/ALCops.TestAutomationCop.Test/ALCops.TestAutomationCop.Test.csproj +++ b/src/ALCops.TestAutomationCop.Test/ALCops.TestAutomationCop.Test.csproj @@ -60,12 +60,12 @@ - + -