Assert.Throws() hides details of inner AssertionException

Bug #800089 reported by Sergey S.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
Fix Released
Medium
Charlie Poole
NUnit V2
Fix Released
Medium
Charlie Poole

Bug Description

NUnit 2.5.9.10348

If AssertionException happens in a delegate provided to Assert.Throws() the diagnostic message does display no details making it hard to know which of asserts failed:

Test 'Test.Issue' failed:
  Expected: <System.InvalidOperationException>
  But was: <NUnit.Framework.AssertionException>

instead it would be good to display the assert message if AssertionException was thrown like:

Test 'Test.Issue' failed:
  Expected: <System.InvalidOperationException>
  But was: <NUnit.Framework.AssertionException> ("Cannot start with zero")

plus the inner stack trace. Please see the test attached.

Related branches

Revision history for this message
Sergey S. (frogbot) wrote :
Revision history for this message
Charlie Poole (charlie.poole) wrote :

Normally, one would expect Assert.Throws to be used with one of the methods under test rather than with a test method. Nevertheless, it seems useful to give more info about the exception that was actually thrown.

Changed in nunitv2:
status: New → Triaged
importance: Undecided → Low
Changed in nunitv2:
milestone: none → 2.6.0
Changed in nunitv2:
importance: Low → Medium
assignee: nobody → Charlie Poole (charlie.poole)
Changed in nunitv2:
status: Triaged → In Progress
Changed in nunitv2:
status: In Progress → Fix Committed
Changed in nunit-3.0:
status: New → Triaged
importance: Undecided → Medium
Changed in nunit-3.0:
milestone: none → 2.9.6
Changed in nunitv2:
status: Fix Committed → Fix Released
Changed in nunit-3.0:
assignee: nobody → Charlie Poole (charlie.poole)
Changed in nunit-3.0:
status: Triaged → In Progress
Changed in nunit-3.0:
status: In Progress → Fix Committed
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

Bug attachments

Remote bug watches

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