Skip to content

InRange-Constraint must work with object #1674

@NUnitTester

Description

@NUnitTester

The following code does work even if myObj is from a class no special interface is implemented:

Assert.That(myObj, Is.EqualTo(expcted).Using(myComparer));
Assert.That(myObj, Is.InRange(expcted1, expcted2).Using(myComparer));

There must be a inheritance of IComparable, or it does not compile. (NUnit 3.4.1)
This is an error, because it must also work with objects.

  • the type of myObj and expected1 I cannot change, because it is a external type from a library
  • a comparer is supported, so it should work
  • the constructor of InRangeConstraint calls the Compare-Methode of IComparable of expected1 not regarding the comparer in the Using to check the relation between from and to. This is a big bug in my eyes, using the wrong comparer.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions