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

[bug] Code fix for NUnit2005 does not correctly fix Assert.AreEqual if the third argument is not the delta #717

Closed
Bartleby2718 opened this issue Mar 31, 2024 · 4 comments

Comments

@Bartleby2718
Copy link
Contributor

Currently,

    [Test]
    public void TestMethod()
    {
        Assert.AreEqual(delta: 0.0000001d, actual: 3d, expected: 2d);
    }

is transformed into

    [Test]
    public void TestMethod()
    {
        Assert.That(actual: 3d, Is.EqualTo(delta: 0.0000001d).Within(2d));
    }

#716 fixes the Is.EqualTo part, but not the Within part. This issue is about the Within part.

Bartleby2718 added a commit to Bartleby2718/nunit.analyzers that referenced this issue Mar 31, 2024
@Bartleby2718
Copy link
Contributor Author

Bartleby2718 commented Mar 31, 2024

I can re-target Bartleby2718#1 once #716 is merged.

@Bartleby2718
Copy link
Contributor Author

It seems like accessing expected or actual by index (e.g. arguments[0]) is prevalent, but I'm not sure whether you want to file an issue for everything or fix everything in one PR.

  • If you file an issue for each *CodeFix file, that's going to be dozens of similar GitHub issues.
  • If you file one issue for everything, the PR is going to be too big, making it harder to review.

@manfred-brands
Copy link
Member

@Bartleby2718 I think one PR to fix all ClassicModelAssertUsage CodeFixes to be 'named parameter' would be the best. It allows us to come up with a more consistent design instead of 24 similar PRs with potential lot of duplication.

@Bartleby2718
Copy link
Contributor Author

Closing in favor of #712

@mikkelbu mikkelbu added this to the Closed Without Action milestone Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants