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

Fix wrong type for expected to be passed to Is.EqualTo when Within is used. #827

Open
manfred-brands opened this issue Jan 9, 2025 · 0 comments

Comments

@manfred-brands
Copy link
Member

From version 4.3.0 the numeric equality is type aware, where the type passed to Within must be the same as the type passed to EqualTo:

e.g.: Is.EqualTo(0L).Within(0.1)); result in an error as it isn't clear if the user wanted integral comparison (EqualTo(0L)) or floating point Within(0.1)

We can follow two paths:

  1. Ignore the 0L and assume all comparison with a Within are double. This would need changing in NUnit.
  2. Warn in the analyzer about the different types and allow a code fix to change 0L into 0.0. Or in case of a non-constant to add a cast.
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

1 participant