|
5 | 5 |
|
6 | 6 | namespace StyleCop.Analyzers.Test.CSharp8.Settings |
7 | 7 | { |
| 8 | + using System; |
8 | 9 | using System.Collections.Immutable; |
9 | 10 | using System.Threading; |
10 | 11 | using System.Threading.Tasks; |
@@ -172,20 +173,28 @@ public async Task VerifyInvalidReferenceBehaviorFromEditorConfigAsync() |
172 | 173 | Assert.Equal("[InvalidReference]", styleCopSettings.DocumentationRules.GetCopyrightText("unused")); |
173 | 174 | } |
174 | 175 |
|
175 | | - [Fact] |
176 | | - public async Task VerifyEditorConfigSettingsReadCorrectlyDirectivePlacementWithoutSeverityLevelAsync() |
| 176 | + [Theory] |
| 177 | + [InlineData("outside_namespace")] |
| 178 | + [InlineData("inside_namespace")] |
| 179 | + public async Task VerifyEditorConfigSettingsReadCorrectlyDirectivePlacementWithoutSeverityLevelAsync(string placement) |
177 | 180 | { |
178 | | - var settings = @"root = true |
| 181 | + var expected = placement switch |
| 182 | + { |
| 183 | + "outside_namespace" => UsingDirectivesPlacement.OutsideNamespace, |
| 184 | + "inside_namespace" => UsingDirectivesPlacement.InsideNamespace, |
| 185 | + _ => throw new InvalidOperationException(), |
| 186 | + }; |
| 187 | + var settings = $@"root = true |
179 | 188 |
|
180 | 189 | [*] |
181 | | -csharp_using_directive_placement = outside_namespace |
| 190 | +csharp_using_directive_placement = {placement} |
182 | 191 | "; |
183 | 192 | var context = await this.CreateAnalysisContextFromEditorConfigAsync(settings).ConfigureAwait(false); |
184 | 193 |
|
185 | 194 | var styleCopSettings = context.GetStyleCopSettings(CancellationToken.None); |
186 | 195 |
|
187 | 196 | Assert.NotNull(styleCopSettings.OrderingRules); |
188 | | - Assert.Equal(UsingDirectivesPlacement.OutsideNamespace, styleCopSettings.OrderingRules.UsingDirectivesPlacement); |
| 197 | + Assert.Equal(expected, styleCopSettings.OrderingRules.UsingDirectivesPlacement); |
189 | 198 | } |
190 | 199 |
|
191 | 200 | protected virtual AnalyzerConfigOptionsProvider CreateAnalyzerConfigOptionsProvider(AnalyzerConfigSet analyzerConfigSet) |
|
0 commit comments