Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code fix for MSTEST0021 #3827

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Add code fix for MSTEST0021 #3827

wants to merge 14 commits into from

Conversation

engyebrahim
Copy link
Member

fix: #3665

# Conflicts:
#	src/Analyzers/MSTest.Analyzers.CodeFixes/CodeFixResources.Designer.cs
#	src/Analyzers/MSTest.Analyzers.CodeFixes/CodeFixResources.resx
@engyebrahim engyebrahim marked this pull request as ready for review September 23, 2024 13:29

[TestClass]
public class MyTestClass
: IDisposable
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this related to BaseList ready function as i tried a lot nothing there. after using the function in removing it removes the new line and in add in adds the newline


await VerifyCS.VerifyAnalyzerAsync(code);
public async Task WhenTestClassHasTestCleanup_AndHasDispose_Diagnostic()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure about this one? what if the two bodies conflicts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user have to fix it, in old fix we did it like the with Amaury

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

public class LocalBase{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if this class has got a dispose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in all fix we were working was the first layer

public class MyTestClass
: IDisposable
{
public void Dispose()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the usual fix for implementing the interface gives the not virtual one

Copy link
Contributor

@MarcoRossignoli MarcoRossignoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions for you and @Evangelink

Copy link
Member

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would need to look at roslyn and roslyn-analyzer code fixes but it feels wrong that we have to do all of these actions ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add code fix for MSTEST0021
3 participants