← Back to team overview

nunit-core team mailing list archive

[Bug 897289] [NEW] Is.Empty constraint has unclear failure message

 

Public bug reported:

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".

** Affects: nunitv2
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/897289

Title:
  Is.Empty constraint has unclear failure message

Status in NUnit V2 Test Framework:
  New

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".

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/897289/+subscriptions


Follow ups

References