The Assert.That constraints work on type object and the compiler doesn't detect comparing non-matching types.
The rules SameAsIncompatibleTypes and EqualToIncompatibleTypes made a good start on this but there are many other asserts.
This ticket is to augment these rules to:
Work on more asserts, such as Is.GreaterThanOrEquals etc.
Work on classic asserts, like Assert.AreEqual
The compiler is also happy to allow:
object instance1 = new object();
object instance2 = new object();
Assert.That(instance1, Is.LessThan(instance2));
but it does not allow:
Assert.Less(instance1, instance2);
Augment the incompatible type check to verify that the types implement IComparable where needed or add a new Comparable analyzer.
The
Assert.That
constraints work on typeobject
and the compiler doesn't detect comparing non-matching types. The rulesSameAsIncompatibleTypes
andEqualToIncompatibleTypes
made a good start on this but there are many other asserts.This ticket is to augment these rules to:
Is.GreaterThanOrEquals
etc.Assert.AreEqual
The compiler is also happy to allow:
but it does not allow:
Augment the incompatible type check to verify that the types implement
IComparable
where needed or add a new Comparable analyzer.