-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unused type parameter (RCS1164) (#1196)
- Loading branch information
1 parent
6d2eb38
commit 0568588
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Tests/Analyzers.Tests/RCS1164UnusedTypeParameterTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) Josef Pihrt and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis; | ||
using Roslynator.CSharp.CodeFixes; | ||
using Roslynator.Testing.CSharp; | ||
using Xunit; | ||
|
||
namespace Roslynator.CSharp.Analysis.Tests; | ||
|
||
public class RCS1164UnusedTypeParameterTests : AbstractCSharpDiagnosticVerifier<UnusedParameter.UnusedParameterAnalyzer, UnusedParameterCodeFixProvider> | ||
{ | ||
public override DiagnosticDescriptor Descriptor { get; } = DiagnosticRules.UnusedTypeParameter; | ||
|
||
[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.UnusedTypeParameter)] | ||
public async Task TestNoDiagnostic_DependencyPropertyEventArgs() | ||
{ | ||
await VerifyNoDiagnosticAsync(@" | ||
using System; | ||
public static class TestClass | ||
{ | ||
public static void RunDelegate<T>(object arg) | ||
{ | ||
RunDelegate(arg, (T arg) => | ||
{ | ||
if (arg is string stringArg) | ||
{ | ||
Console.WriteLine(stringArg); | ||
} | ||
} | ||
); | ||
} | ||
private static void RunDelegate( | ||
object arg, | ||
Delegate _delegate | ||
) | ||
{ | ||
_delegate.DynamicInvoke(arg); | ||
} | ||
} | ||
"); | ||
} | ||
} |