/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Analyzers/CSharp/Tests/RemoveAsyncModifier/RemoveAsyncModifierInterfaceImplementationOrOverrideTests.cs
118 строк
3 KB
Cyrus Najmabadi
almost there
02 янв 2026, 22:35
02 янв 2026, 22:35
33e7a47
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.RemoveAsyncModifier; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveAsyncModifier; using VerifyCS = CSharpCodeFixVerifier< CSharpRemoveUnnecessaryAsyncModifierInterfaceImplementationOrOverrideDiagnosticAnalyzer, CSharpRemoveAsyncModifierCodeFixProvider>; [Trait(Traits.Feature, Traits.Features.CodeActionsRemoveAsyncModifier)] public sealed class RemoveAsyncModifierInterfaceImplementationOrOverrideTests { [Fact] public Task ImplicitInterfaceImplementation() => VerifyCS.VerifyCodeFixAsync( """ using System.Threading.Tasks; interface I { Task Goo(); } class C : I { public {|IDE0391:async|} Task Goo(){} } """, """ using System.Threading.Tasks; interface I { Task Goo(); } class C : I { public Task Goo() { return Task.CompletedTask; } } """); [Fact] public Task ExplicitInterfaceImplementation() => VerifyCS.VerifyCodeFixAsync( """ using System.Threading.Tasks; interface I { Task Goo(); } class C : I { {|IDE0391:async|} Task I.Goo(){} } """, """ using System.Threading.Tasks; interface I { Task Goo(); } class C : I { Task I.Goo() { return Task.CompletedTask; } } """); [Fact] public Task Override() => VerifyCS.VerifyCodeFixAsync( """ using System.Threading.Tasks; class B { public virtual Task Goo() => Task.CompletedTask; } class C : B { public override {|IDE0391:async|} Task Goo(){} } """, """ using System.Threading.Tasks; class B { public virtual Task Goo() => Task.CompletedTask; } class C : B { public override Task Goo() { return Task.CompletedTask; } } """); }