Skip to content

When Assert.Multiple is found, should suggest to convert to Assert.EnterMultipleScope #866

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

Open
OsirisTerje opened this issue May 16, 2025 · 1 comment · May be fixed by #878
Open

When Assert.Multiple is found, should suggest to convert to Assert.EnterMultipleScope #866

OsirisTerje opened this issue May 16, 2025 · 1 comment · May be fixed by #878
Assignees
Milestone

Comments

@OsirisTerje
Copy link
Member

A new rule should be made that helps the user to convert from Assert.Multiple to Assert.EnterMultipleScope.

Also see issue #865

@mikkelbu
Copy link
Member

mikkelbu commented Jun 2, 2025

Looking at https://docs.nunit.org/articles/nunit/writing-tests/assertions/multiple-asserts.html it is essentially changing

Assert.Multiple(() =>
{
    ClassicAssert.AreEqual(5.2, result.RealPart, "Real Part");
    ClassicAssert.AreEqual(3.9, result.ImaginaryPart, "Imaginary Part");
});

into

using (Assert.EnterMultipleScope())
{
    ClassicAssert.AreEqual(5.2, result.RealPart, "Real Part");
    ClassicAssert.AreEqual(3.9, result.ImaginaryPart, "Imaginary Part");
}

@mikkelbu mikkelbu added this to the Release 4.9 milestone Jun 2, 2025
@mikkelbu mikkelbu self-assigned this Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants