@@ -15,7 +15,7 @@ namespace StyleCop.Analyzers.Test.NamingRules
1515 public class SA1314UnitTests : CodeFixVerifier
1616 {
1717 [ Fact ]
18- public async Task TestGenericParameterDoesNotStartWithTAsync ( )
18+ public async Task TestTypeParameterDoesNotStartWithTAsync ( )
1919 {
2020 var testCode = @"
2121public interface IFoo<Key>
@@ -35,7 +35,7 @@ public interface IFoo<TKey>
3535 }
3636
3737 [ Fact ]
38- public async Task TestGenericParameterDoesNotStartWithTPlusParameterUsedAsync ( )
38+ public async Task TestTypeParameterDoesNotStartWithTPlusParameterUsedAsync ( )
3939 {
4040 var testCode = @"
4141public class Foo<Key>
@@ -65,7 +65,7 @@ void Test()
6565 }
6666
6767 [ Fact ]
68- public async Task TestGenericParameterStartsWithLowerTAsync ( )
68+ public async Task TestTypeParameterStartsWithLowerTAsync ( )
6969 {
7070 var testCode = @"
7171public interface IFoo<tKey>
@@ -85,7 +85,7 @@ public interface IFoo<TtKey>
8585 }
8686
8787 [ Fact ]
88- public async Task TestInnerGenericParameterDoesNotStartWithTAsync ( )
88+ public async Task TestInnerTypeParameterDoesNotStartWithTAsync ( )
8989 {
9090 var testCode = @"
9191public class Bar
@@ -111,7 +111,7 @@ public class Foo<TKey>
111111 }
112112
113113 [ Fact ]
114- public async Task TestGenericParameterDoesStartWithTAsync ( )
114+ public async Task TestTypeParameterDoesStartWithTAsync ( )
115115 {
116116 var testCode = @"public interface IFoo<TKey>
117117{
@@ -121,7 +121,7 @@ public async Task TestGenericParameterDoesStartWithTAsync()
121121 }
122122
123123 [ Fact ]
124- public async Task TestInnerGenericParameterDoesStartWithTAsync ( )
124+ public async Task TestInnerTypeParameterDoesStartWithTAsync ( )
125125 {
126126 var testCode = @"
127127public class Bar
@@ -135,7 +135,7 @@ public class Foo<TKey>
135135 }
136136
137137 [ Fact ]
138- public async Task TestGenericParameterDoesNotStartWithTWithMemberMatchingTargetTypeAsync ( )
138+ public async Task TestTypeParameterDoesNotStartWithTWithMemberMatchingTargetTypeAsync ( )
139139 {
140140 string testCode = @"
141141public class Foo<Key>
@@ -157,7 +157,7 @@ public class Foo<TKey>
157157 }
158158
159159 [ Fact ]
160- public async Task TestNestedGenericParameterDoesNotStartWithTWithConflictAsync ( )
160+ public async Task TestNestedTypeParameterDoesNotStartWithTWithConflictAsync ( )
161161 {
162162 string testCode = @"
163163public class Outer<TKey>
@@ -182,7 +182,7 @@ public class Foo<TKey1>
182182 }
183183
184184 [ Fact ]
185- public async Task TestNestedGenericParameterDoesNotStartWithTWithMemberConflictAsync ( )
185+ public async Task TestNestedTypeParameterDoesNotStartWithTWithMemberConflictAsync ( )
186186 {
187187 string testCode = @"
188188public class Outer<TKey>
@@ -208,6 +208,59 @@ public class Foo<TKey1>
208208 await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
209209 }
210210
211+ [ Fact ]
212+ public async Task TestTypeParameterDoesNotStartWithTAndTypeConflictAsync ( )
213+ {
214+ string testCode = @"
215+ public class TFoo
216+ {
217+ }
218+
219+ public class Bar<Foo>
220+ {
221+ }" ;
222+ string fixedCode = @"
223+ public class TFoo
224+ {
225+ }
226+
227+ public class Bar<TFoo1>
228+ {
229+ }" ;
230+
231+ DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithLocation ( 6 , 18 ) ;
232+
233+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
234+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
235+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
236+ }
237+
238+ [ Fact ]
239+ public async Task TestTypeParameterInMethodSignatureDoesNotStartWithTAsync ( )
240+ {
241+ var testCode = @"
242+ public class Foo
243+ {
244+ public void Bar<Baz>()
245+ {
246+ }
247+ }" ;
248+
249+ DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithLocation ( 4 , 21 ) ;
250+
251+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
252+
253+ var fixedCode = @"
254+ public class Foo
255+ {
256+ public void Bar<TBaz>()
257+ {
258+ }
259+ }" ;
260+
261+ await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
262+ }
263+
211264 protected override IEnumerable < DiagnosticAnalyzer > GetCSharpDiagnosticAnalyzers ( )
212265 {
213266 yield return new SA1314TypeParameterNamesMustBeginWithT ( ) ;
0 commit comments