Skip to content

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

@manfred-brands

Description

@manfred-brands

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions