Is.Empty constraint has unclear failure message

Bug #897289 reported by GT
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
Fix Released
Low
Charlie Poole
NUnit V2
Fix Released
Low
Charlie Poole

Bug Description

Using v2.6 b2.

    var emptyEnumerable = GetEmptyIEnumerable();
    var emptyString = GetEmptyString();

    Assert.That(emptyEnumerable, Is.Empty);
    Assert.That(emptyString, Is.Empty);

If the methods under test in the above example return 'null' instead of the expected string or IEnumerable, the failure message states "System.ArgumentException: The actual value must be an IEnumerable".

At least the test is failing correctly, so the problem's not too bad, but it can be slightly non-intuitive to fix the test, especially when the actual value being tested is a string.

I'd expect it either to say "The actual value must be an IEnumerable or a string", or it to give a more precise answer, something like "The actual value was not empty" / "not empty but null".

Related branches

Changed in nunitv2:
status: New → Triaged
importance: Undecided → Low
Changed in nunitv2:
milestone: none → 2.6.0
assignee: nobody → Charlie Poole (charlie.poole)
Changed in nunit-3.0:
status: New → Triaged
importance: Undecided → Low
Changed in nunitv2:
milestone: 2.6.0b3 → 2.6.0
Changed in nunitv2:
status: Triaged → Fix Committed
Changed in nunit-3.0:
assignee: nobody → Charlie Poole (charlie.poole)
milestone: none → 2.9.6
status: Triaged → Fix Committed
Changed in nunitv2:
status: Fix Committed → Fix Released
Changed in nunit-3.0:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.