Skip to content

Commit 7781c99

Browse files
committed
Merge remote-tracking branch 'DotNetAnalyzers/master' into testing-library
2 parents 63b3b59 + fe64add commit 7781c99

5 files changed

Lines changed: 347 additions & 53 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/DocumentationRules/SA1600CSharp7UnitTests.cs

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,201 @@
33

44
namespace StyleCop.Analyzers.Test.CSharp7.DocumentationRules
55
{
6+
using System.Threading.Tasks;
7+
using Microsoft.CodeAnalysis.CSharp;
68
using StyleCop.Analyzers.Test.DocumentationRules;
9+
using Xunit;
710

811
public class SA1600CSharp7UnitTests : SA1600UnitTests
912
{
13+
protected override LanguageVersion LanguageVersion => LanguageVersion.CSharp7_2;
14+
15+
[Fact]
16+
public async Task TestPrivateProtectedDelegateWithoutDocumentationAsync()
17+
{
18+
await this.TestNestedDelegateDeclarationDocumentationAsync("private protected", true, false).ConfigureAwait(false);
19+
}
20+
21+
[Fact]
22+
public async Task TestPrivateProtectedDelegateWithDocumentationAsync()
23+
{
24+
await this.TestNestedDelegateDeclarationDocumentationAsync("private protected", false, true).ConfigureAwait(false);
25+
}
26+
27+
[Fact]
28+
public async Task TestPrivateProtectedMethodWithoutDocumentationAsync()
29+
{
30+
await this.TestMethodDeclarationDocumentationAsync("private protected", false, true, false).ConfigureAwait(false);
31+
}
32+
33+
[Fact]
34+
public async Task TestPrivateProtectedMethodWithDocumentationAsync()
35+
{
36+
await this.TestMethodDeclarationDocumentationAsync("private protected", false, false, true).ConfigureAwait(false);
37+
}
38+
39+
[Fact]
40+
public async Task TestPrivateProtectedConstructorWithoutDocumentationAsync()
41+
{
42+
await this.TestConstructorDeclarationDocumentationAsync("private protected", true, false).ConfigureAwait(false);
43+
}
44+
45+
[Fact]
46+
public async Task TestPrivateProtectedConstructorWithDocumentationAsync()
47+
{
48+
await this.TestConstructorDeclarationDocumentationAsync("private protected", false, true).ConfigureAwait(false);
49+
}
50+
51+
[Fact]
52+
public async Task TestPrivateProtectedFieldWithoutDocumentationAsync()
53+
{
54+
await this.TestFieldDeclarationDocumentationAsync(testSettings: null, "private protected", true, false).ConfigureAwait(false);
55+
56+
// Re-test with the 'documentPrivateElements' setting enabled (doesn't impact fields)
57+
var testSettings = @"
58+
{
59+
""settings"": {
60+
""documentationRules"": {
61+
""documentPrivateElements"": true
62+
}
63+
}
64+
}
65+
";
66+
67+
await this.TestFieldDeclarationDocumentationAsync(testSettings, "private protected", true, false).ConfigureAwait(false);
68+
69+
// Re-test with the 'documentInternalElements' setting disabled (does impact fields)
70+
testSettings = @"
71+
{
72+
""settings"": {
73+
""documentationRules"": {
74+
""documentInternalElements"": false
75+
}
76+
}
77+
}
78+
";
79+
80+
await this.TestFieldDeclarationDocumentationAsync(testSettings, "private protected", false, false).ConfigureAwait(false);
81+
82+
// Re-test with the 'documentPrivateFields' setting enabled (does impact fields)
83+
testSettings = @"
84+
{
85+
""settings"": {
86+
""documentationRules"": {
87+
""documentPrivateFields"": true
88+
}
89+
}
90+
}
91+
";
92+
93+
await this.TestFieldDeclarationDocumentationAsync(testSettings, "private protected", true, false).ConfigureAwait(false);
94+
}
95+
96+
[Fact]
97+
public async Task TestPrivateProtectedFieldWithDocumentationAsync()
98+
{
99+
await this.TestFieldDeclarationDocumentationAsync(testSettings: null, "private protected", false, true).ConfigureAwait(false);
100+
101+
// Re-test with the 'documentPrivateElements' setting enabled (doesn't impact fields)
102+
var testSettings = @"
103+
{
104+
""settings"": {
105+
""documentationRules"": {
106+
""documentPrivateElements"": true
107+
}
108+
}
109+
}
110+
";
111+
112+
await this.TestFieldDeclarationDocumentationAsync(testSettings, "private protected", false, true).ConfigureAwait(false);
113+
114+
// Re-test with the 'documentInternalElements' setting disabled (does impact fields)
115+
testSettings = @"
116+
{
117+
""settings"": {
118+
""documentationRules"": {
119+
""documentInternalElements"": false
120+
}
121+
}
122+
}
123+
";
124+
125+
await this.TestFieldDeclarationDocumentationAsync(testSettings, "private protected", false, true).ConfigureAwait(false);
126+
127+
// Re-test with the 'documentPrivateFields' setting enabled (does impact fields)
128+
testSettings = @"
129+
{
130+
""settings"": {
131+
""documentationRules"": {
132+
""documentPrivateFields"": true
133+
}
134+
}
135+
}
136+
";
137+
138+
await this.TestFieldDeclarationDocumentationAsync(testSettings, "private protected", false, true).ConfigureAwait(false);
139+
}
140+
141+
[Fact]
142+
public async Task TestPrivateProtectedPropertyWithoutDocumentationAsync()
143+
{
144+
await this.TestPropertyDeclarationDocumentationAsync("private protected", false, true, false).ConfigureAwait(false);
145+
}
146+
147+
[Fact]
148+
public async Task TestPrivateProtectedPropertyWithDocumentationAsync()
149+
{
150+
await this.TestPropertyDeclarationDocumentationAsync("private protected", false, false, true).ConfigureAwait(false);
151+
}
152+
153+
[Fact]
154+
public async Task TestPrivateProtectedIndexerWithoutDocumentationAsync()
155+
{
156+
await this.TestIndexerDeclarationDocumentationAsync("private protected", false, true, false).ConfigureAwait(false);
157+
}
158+
159+
[Fact]
160+
public async Task TestPrivateProtectedIndexerWithDocumentationAsync()
161+
{
162+
await this.TestIndexerDeclarationDocumentationAsync("private protected", false, false, true).ConfigureAwait(false);
163+
}
164+
165+
[Fact]
166+
public async Task TestPrivateProtectedEventWithoutDocumentationAsync()
167+
{
168+
await this.TestEventDeclarationDocumentationAsync("private protected", false, true, false).ConfigureAwait(false);
169+
}
170+
171+
[Fact]
172+
public async Task TestPrivateProtectedEventWithDocumentationAsync()
173+
{
174+
await this.TestEventDeclarationDocumentationAsync("private protected", false, false, true).ConfigureAwait(false);
175+
}
176+
177+
[Fact]
178+
public async Task TestPrivateProtectedEventFieldWithoutDocumentationAsync()
179+
{
180+
await this.TestEventFieldDeclarationDocumentationAsync("private protected", true, false).ConfigureAwait(false);
181+
}
182+
183+
[Fact]
184+
public async Task TestPrivateProtectedEventFieldWithDocumentationAsync()
185+
{
186+
await this.TestEventFieldDeclarationDocumentationAsync("private protected", false, true).ConfigureAwait(false);
187+
}
188+
189+
protected override async Task TestTypeWithoutDocumentationAsync(string type, bool isInterface)
190+
{
191+
await base.TestTypeWithoutDocumentationAsync(type, isInterface).ConfigureAwait(false);
192+
193+
await this.TestNestedTypeDeclarationDocumentationAsync(type, "private protected", true, false).ConfigureAwait(false);
194+
}
195+
196+
protected override async Task TestTypeWithDocumentationAsync(string type)
197+
{
198+
await base.TestTypeWithDocumentationAsync(type).ConfigureAwait(false);
199+
200+
await this.TestNestedTypeDeclarationDocumentationAsync(type, "private protected", false, true).ConfigureAwait(false);
201+
}
10202
}
11203
}

0 commit comments

Comments
 (0)