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

Allow NUnit2005 to recognize Is.Empty #801

Closed
RenderMichael opened this issue Dec 4, 2024 · 1 comment · Fixed by #813
Closed

Allow NUnit2005 to recognize Is.Empty #801

RenderMichael opened this issue Dec 4, 2024 · 1 comment · Fixed by #813
Milestone

Comments

@RenderMichael
Copy link

We have the following code:

Assert.AreEqual(string.Empty, element.GetDomProperty("value"));
Assert.AreEqual("", element.GetDomProperty("value"));

The NUnit2005 fixer transforms these into

Assert.That(element.GetDomProperty("value"), Is.EqualTo(string.Empty));
Assert.That(element.GetDomProperty("value"), Is.EqualTo(""));

Both of these could become Is.Empty instead

@manfred-brands
Copy link
Member

@RenderMichael Yes, it could, but that wouldn't be a direct conversion of the AreEqual but of Assert.IsEmpty
But as it is better code, I agree.

There are a few more use cases:

Assert.AreEquals(Guid.Empty, value);
Assert.AreEqual(Enumerable.Empty<char>(), value);
Assert.AreEqual(Array.Empty<char>(), value);
Assert.AreNotEqual(String.Empty, value);
Assert.AreNotEqual(ImmutableArray<int>.Empty, value);

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

Successfully merging a pull request may close this issue.

3 participants