From fbeef562e2c07bb535d14ab82c29b47dafaf549f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Hellander?= Date: Tue, 19 Dec 2023 21:38:30 +0100 Subject: [PATCH] Generalize tests for SA1600 concerning partial types --- .../DocumentationRules/SA1600UnitTests.cs | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1600UnitTests.cs b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1600UnitTests.cs index 7fd1fc16d..4e5561632 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1600UnitTests.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1600UnitTests.cs @@ -56,28 +56,13 @@ public async Task TestBaseTypeWithDocumentationAsync(string type) await this.TestTypeWithDocumentationAsync(type).ConfigureAwait(false); } - [Fact] - public async Task TestPartialClassWithoutDocumentationAsync() - { - await this.TestTypeDeclarationDocumentationAsync("class", "partial", false, false).ConfigureAwait(false); - await this.TestTypeDeclarationDocumentationAsync("class", "internal partial", false, false).ConfigureAwait(false); - await this.TestTypeDeclarationDocumentationAsync("class", "public partial", false, false).ConfigureAwait(false); - } - - [Fact] - public async Task TestPartialStructWithoutDocumentationAsync() - { - await this.TestTypeDeclarationDocumentationAsync("struct", "partial", false, false).ConfigureAwait(false); - await this.TestTypeDeclarationDocumentationAsync("struct", "internal partial", false, false).ConfigureAwait(false); - await this.TestTypeDeclarationDocumentationAsync("struct", "public partial", false, false).ConfigureAwait(false); - } - - [Fact] - public async Task TestPartialInterfaceWithoutDocumentationAsync() + [Theory] + [MemberData(nameof(CommonMemberData.TypeDeclarationKeywords), MemberType = typeof(CommonMemberData))] + public async Task TestPartialTypeWithoutDocumentationAsync(string type) { - await this.TestTypeDeclarationDocumentationAsync("interface", "partial", false, false).ConfigureAwait(false); - await this.TestTypeDeclarationDocumentationAsync("interface", "internal partial", false, false).ConfigureAwait(false); - await this.TestTypeDeclarationDocumentationAsync("interface", "public partial", false, false).ConfigureAwait(false); + await this.TestTypeDeclarationDocumentationAsync(type, "partial", false, false).ConfigureAwait(false); + await this.TestTypeDeclarationDocumentationAsync(type, "internal partial", false, false).ConfigureAwait(false); + await this.TestTypeDeclarationDocumentationAsync(type, "public partial", false, false).ConfigureAwait(false); } [Fact]