Skip to content

Commit 43459b0

Browse files
authored
Merge pull request #2560 from dlemstra/test-2236
Added unit test for issue #2236
2 parents 7cf7332 + 2de022f commit 43459b0

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1642UnitTests.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ namespace StyleCop.Analyzers.Test.DocumentationRules
2020
[UseCulture("en-US")]
2121
public class SA1642UnitTests : CodeFixVerifier
2222
{
23+
private string settings = null;
24+
2325
[Theory]
2426
[InlineData("class")]
2527
[InlineData("struct")]
@@ -861,6 +863,30 @@ public TestClass() { }
861863
Assert.Empty(offeredFixes);
862864
}
863865

866+
[Theory]
867+
[InlineData("class")]
868+
[InlineData("struct")]
869+
[WorkItem(2236, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2236")]
870+
public async Task TestDocumentationCultureIsUsedAsync(string typeKind)
871+
{
872+
this.settings = @"
873+
{
874+
""settings"": {
875+
""documentationRules"": {
876+
""documentationCulture"": ""en-GB"",
877+
}
878+
}
879+
}
880+
";
881+
882+
await this.TestConstructorCorrectDocumentationSimpleAsync(
883+
typeKind,
884+
"public",
885+
"Initialises a new instance of the ",
886+
" " + typeKind,
887+
false).ConfigureAwait(false);
888+
}
889+
864890
protected override Project ApplyCompilationOptions(Project project)
865891
{
866892
var resolver = new TestXmlReferenceResolver();
@@ -942,6 +968,16 @@ protected override CodeFixProvider GetCSharpCodeFixProvider()
942968
return new SA1642SA1643CodeFixProvider();
943969
}
944970

971+
protected override string GetSettings()
972+
{
973+
if (this.settings == null)
974+
{
975+
return base.GetSettings();
976+
}
977+
978+
return this.settings;
979+
}
980+
945981
private async Task TestEmptyConstructorAsync(string typeKind, string modifiers)
946982
{
947983
var testCode = @"namespace FooNamespace

0 commit comments

Comments
 (0)