@@ -104,20 +104,22 @@ private class TestClass10 { }
104104 }
105105
106106 /// <summary>
107- /// Verifies that the analyzer will properly handle class access levels.
107+ /// Verifies that the analyzer will properly handle type access levels.
108108 /// </summary>
109+ /// <param name="keyword">The keyword used to declare the type.</param>
109110 /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
110- [ Fact ]
111- public async Task TestClassOrderingAsync ( )
111+ [ Theory ]
112+ [ MemberData ( nameof ( CommonMemberData . TypeDeclarationKeywords ) , MemberType = typeof ( CommonMemberData ) ) ]
113+ public async Task TestTypeOrderingAsync ( string keyword )
112114 {
113- var testCode = @"internal class TestClass1 { }
114- public class TestClass2 { }
115+ var testCode = $ @ "internal { keyword } TestClass1 {{ } }
116+ public { keyword } {{|#0: TestClass2|}} {{ } }
115117" ;
116118
117- var expected = Diagnostic ( ) . WithLocation ( 2 , 14 ) . WithArguments ( "public" , "internal" ) ;
119+ var expected = Diagnostic ( ) . WithLocation ( 0 ) . WithArguments ( "public" , "internal" ) ;
118120
119- var fixedCode = @"public class TestClass2 { }
120- internal class TestClass1 { }
121+ var fixedCode = $ @ "public { keyword } TestClass2 {{ } }
122+ internal { keyword } TestClass1 {{ } }
121123" ;
122124
123125 await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -126,12 +128,14 @@ internal class TestClass1 { }
126128 /// <summary>
127129 /// Verifies that the analyzer will properly handle interfaces before classes.
128130 /// </summary>
131+ /// <param name="keyword">The keyword used to declare the type.</param>
129132 /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
130- [ Fact ]
131- public async Task TestInternalInterfaceBeforePublicClassAsync ( )
133+ [ Theory ]
134+ [ MemberData ( nameof ( CommonMemberData . DataTypeDeclarationKeywords ) , MemberType = typeof ( CommonMemberData ) ) ]
135+ public async Task TestInternalInterfaceBeforePublicClassAsync ( string keyword )
132136 {
133- var testCode = @"internal interface ITestInterface { }
134- public class TestClass2 { }
137+ var testCode = $ @ "internal interface ITestInterface {{ } }
138+ public { keyword } TestClass2 {{ } }
135139" ;
136140
137141 await VerifyCSharpDiagnosticAsync ( testCode , DiagnosticResult . EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
0 commit comments