зеркало из https://github.com/microsoft/testfx.git
traial fix (not working as expected)
This commit is contained in:
Родитель
77c969e171
Коммит
b99f04f33d
|
@ -49,7 +49,7 @@ public sealed class PreferTestCleanupOverDisposeFixer : CodeFixProvider
|
|||
CodeAction.Create(
|
||||
CodeFixResources.ReplaceWithTestCleanuFix,
|
||||
c => ReplaceDisposeWithTestCleanupAsync(context.Document, methodDeclaration, c),
|
||||
nameof(TestMethodShouldBeValidCodeFixProvider)),
|
||||
nameof(PreferTestCleanupOverDisposeFixer)),
|
||||
diagnostic);
|
||||
}
|
||||
|
||||
|
@ -82,8 +82,9 @@ public sealed class PreferTestCleanupOverDisposeFixer : CodeFixProvider
|
|||
}
|
||||
else
|
||||
{
|
||||
// If no interfaces left, remove the base list entirely
|
||||
newParent = newParent.WithBaseList(null);
|
||||
SyntaxTriviaList? trailingTrivia = parentClass.BaseList?.GetTrailingTrivia();
|
||||
newParent = newParent.WithBaseList(null).WithOpenBraceToken(parentClass.OpenBraceToken.WithLeadingTrivia(SyntaxFactory.TriviaList()).WithLeadingTrivia(trailingTrivia));
|
||||
newParent = newParent.WithTrailingTrivia(SyntaxFactory.TriviaList());
|
||||
}
|
||||
|
||||
editor.ReplaceNode(parentClass, newParent);
|
||||
|
|
|
@ -71,7 +71,8 @@ public sealed class PreferTestCleanupOverDisposeAnalyzerTests(ITestExecutionCont
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
[TestClass]
|
||||
public class MyTestClass {
|
||||
public class MyTestClass
|
||||
{
|
||||
[TestCleanup]
|
||||
public ValueTask TestCleanup()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче