File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed
StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,48 @@ public class ClassName
146146 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
147147 }
148148
149+ [ Fact ]
150+ public async Task TestEnumMemberWithContentDocumentationAsync ( )
151+ {
152+ var testCode = @"
153+ public enum EnumName
154+ {
155+ /// <summary>
156+ /// Foo.
157+ /// </summary>
158+ EnumMember1 = 0,
159+ }
160+ " ;
161+ await VerifyCSharpDiagnosticAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
162+ }
163+
164+ [ Fact ]
165+ public async Task TestEnumMemberWithDefaultDocumentationAsync ( )
166+ {
167+ var testCode = @"
168+ public enum EnumName
169+ {
170+ /// <summary>
171+ /// Summary description for the EnumMember1 enum member.
172+ /// </summary>
173+ EnumMember1 = 0,
174+
175+ /// <summary>
176+ /// Summary description
177+ /// for the EnumMember2 enum member.
178+ /// </summary>
179+ EnumMember2 = 1,
180+ }
181+ " ;
182+ DiagnosticResult [ ] expected = new [ ]
183+ {
184+ Diagnostic ( ) . WithLocation ( 4 , 9 ) ,
185+ Diagnostic ( ) . WithLocation ( 9 , 9 ) ,
186+ } ;
187+
188+ await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
189+ }
190+
149191 [ Fact ]
150192 public async Task TestClassWithIncludedEmptyDocumentationAsync ( )
151193 {
Original file line number Diff line number Diff line change @@ -273,6 +273,23 @@ public class TestClass
273273 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
274274 }
275275
276+ [ Fact ]
277+ public async Task VerifyThatDuplicatedDocumentationForEnumMemberDoesReportADiagnosticAsync ( )
278+ {
279+ var testCode = @"
280+ public enum EnumName
281+ {
282+ /// <summary>
283+ /// Some documentation.
284+ /// </summary>
285+ /// <remark>Some documentation.</remark>
286+ EnumMember = 0,
287+ }" ;
288+ var expected = Diagnostic ( ) . WithLocation ( 7 , 9 ) ;
289+
290+ await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
291+ }
292+
276293 [ Fact ]
277294 public async Task VerifyThatCorrectIncludedDocumentationDoesNotReportADiagnosticAsync ( )
278295 {
You can’t perform that action at this time.
0 commit comments