44namespace StyleCop . Analyzers . Test . CSharp7 . DocumentationRules
55{
66 using System . Threading . Tasks ;
7- using Microsoft . CodeAnalysis ;
87 using Microsoft . CodeAnalysis . CSharp ;
98 using StyleCop . Analyzers . Test . DocumentationRules ;
109 using Xunit ;
1110
1211 public class SA1600CSharp7UnitTests : SA1600UnitTests
1312 {
14- private string currentTestSettings ;
13+ protected override LanguageVersion LanguageVersion => LanguageVersion . CSharp7_2 ;
1514
1615 [ Fact ]
1716 public async Task TestPrivateProtectedDelegateWithoutDocumentationAsync ( )
@@ -52,10 +51,10 @@ public async Task TestPrivateProtectedConstructorWithDocumentationAsync()
5251 [ Fact ]
5352 public async Task TestPrivateProtectedFieldWithoutDocumentationAsync ( )
5453 {
55- await this . TestFieldDeclarationDocumentationAsync ( "private protected" , true , false ) . ConfigureAwait ( false ) ;
54+ await this . TestFieldDeclarationDocumentationAsync ( testSettings : null , "private protected" , true , false ) . ConfigureAwait ( false ) ;
5655
5756 // Re-test with the 'documentPrivateElements' setting enabled (doesn't impact fields)
58- this . currentTestSettings = @"
57+ var testSettings = @"
5958{
6059 ""settings"": {
6160 ""documentationRules"": {
@@ -65,10 +64,10 @@ public async Task TestPrivateProtectedFieldWithoutDocumentationAsync()
6564}
6665" ;
6766
68- await this . TestFieldDeclarationDocumentationAsync ( "private protected" , true , false ) . ConfigureAwait ( false ) ;
67+ await this . TestFieldDeclarationDocumentationAsync ( testSettings , "private protected" , true , false ) . ConfigureAwait ( false ) ;
6968
7069 // Re-test with the 'documentInternalElements' setting disabled (does impact fields)
71- this . currentTestSettings = @"
70+ testSettings = @"
7271{
7372 ""settings"": {
7473 ""documentationRules"": {
@@ -78,10 +77,10 @@ public async Task TestPrivateProtectedFieldWithoutDocumentationAsync()
7877}
7978" ;
8079
81- await this . TestFieldDeclarationDocumentationAsync ( "private protected" , false , false ) . ConfigureAwait ( false ) ;
80+ await this . TestFieldDeclarationDocumentationAsync ( testSettings , "private protected" , false , false ) . ConfigureAwait ( false ) ;
8281
8382 // Re-test with the 'documentPrivateFields' setting enabled (does impact fields)
84- this . currentTestSettings = @"
83+ testSettings = @"
8584{
8685 ""settings"": {
8786 ""documentationRules"": {
@@ -91,16 +90,16 @@ public async Task TestPrivateProtectedFieldWithoutDocumentationAsync()
9190}
9291" ;
9392
94- await this . TestFieldDeclarationDocumentationAsync ( "private protected" , true , false ) . ConfigureAwait ( false ) ;
93+ await this . TestFieldDeclarationDocumentationAsync ( testSettings , "private protected" , true , false ) . ConfigureAwait ( false ) ;
9594 }
9695
9796 [ Fact ]
9897 public async Task TestPrivateProtectedFieldWithDocumentationAsync ( )
9998 {
100- await this . TestFieldDeclarationDocumentationAsync ( "private protected" , false , true ) . ConfigureAwait ( false ) ;
99+ await this . TestFieldDeclarationDocumentationAsync ( testSettings : null , "private protected" , false , true ) . ConfigureAwait ( false ) ;
101100
102101 // Re-test with the 'documentPrivateElements' setting enabled (doesn't impact fields)
103- this . currentTestSettings = @"
102+ var testSettings = @"
104103{
105104 ""settings"": {
106105 ""documentationRules"": {
@@ -110,10 +109,10 @@ public async Task TestPrivateProtectedFieldWithDocumentationAsync()
110109}
111110" ;
112111
113- await this . TestFieldDeclarationDocumentationAsync ( "private protected" , false , true ) . ConfigureAwait ( false ) ;
112+ await this . TestFieldDeclarationDocumentationAsync ( testSettings , "private protected" , false , true ) . ConfigureAwait ( false ) ;
114113
115114 // Re-test with the 'documentInternalElements' setting disabled (does impact fields)
116- this . currentTestSettings = @"
115+ testSettings = @"
117116{
118117 ""settings"": {
119118 ""documentationRules"": {
@@ -123,10 +122,10 @@ public async Task TestPrivateProtectedFieldWithDocumentationAsync()
123122}
124123" ;
125124
126- await this . TestFieldDeclarationDocumentationAsync ( "private protected" , false , true ) . ConfigureAwait ( false ) ;
125+ await this . TestFieldDeclarationDocumentationAsync ( testSettings , "private protected" , false , true ) . ConfigureAwait ( false ) ;
127126
128127 // Re-test with the 'documentPrivateFields' setting enabled (does impact fields)
129- this . currentTestSettings = @"
128+ testSettings = @"
130129{
131130 ""settings"": {
132131 ""documentationRules"": {
@@ -136,7 +135,7 @@ public async Task TestPrivateProtectedFieldWithDocumentationAsync()
136135}
137136" ;
138137
139- await this . TestFieldDeclarationDocumentationAsync ( "private protected" , false , true ) . ConfigureAwait ( false ) ;
138+ await this . TestFieldDeclarationDocumentationAsync ( testSettings , "private protected" , false , true ) . ConfigureAwait ( false ) ;
140139 }
141140
142141 [ Fact ]
@@ -187,18 +186,6 @@ public async Task TestPrivateProtectedEventFieldWithDocumentationAsync()
187186 await this . TestEventFieldDeclarationDocumentationAsync ( "private protected" , false , true ) . ConfigureAwait ( false ) ;
188187 }
189188
190- protected override string GetSettings ( )
191- {
192- return this . currentTestSettings ?? base . GetSettings ( ) ;
193- }
194-
195- protected override Project CreateProjectImpl ( string [ ] sources , string language , string [ ] filenames )
196- {
197- var project = base . CreateProjectImpl ( sources , language , filenames ) ;
198- var parseOptions = ( CSharpParseOptions ) project . ParseOptions ;
199- return project . WithParseOptions ( parseOptions . WithLanguageVersion ( LanguageVersion . CSharp7_2 ) ) ;
200- }
201-
202189 protected override async Task TestTypeWithoutDocumentationAsync ( string type , bool isInterface )
203190 {
204191 await base . TestTypeWithoutDocumentationAsync ( type , isInterface ) . ConfigureAwait ( false ) ;
0 commit comments