views:

28

answers:

1

I'm using VS Unit Testing Framework and Moq.

When a Moq verification fails, I'll get a Moq.MockException. In the Test Results window, instead of showing the helpful message inside the exception, it just says "Test method XXX threw exception: ..."

Is there a way to tell the VS Unit Test framework always display the message of exceptions of a given type (like Moq.MockException)?

+1  A: 

The short answer is: No. You have to open the Test Details window for that in MSTest (btw. that's one of many reasons why I think MSTest is not the best choice for doing Test-driven development...).

Anyway, there are two possible ways to achieve this (at least that I know of):

  1. Use ReSharper to run your tests.
  2. Use the free Gallio automation platform to run your tests.

HTH!
Thomas

Thomas Weller
I'm indeed considering to move to another unit test framework. Which one is your choice?
jpbochi
If you consider it, I would recommend Gallio. It is basically an automation platform that can run all kinds of testing frameworks (e.g. NUnit, xUnit.net, MSTest...) and comes bundled with MbUnit, which is the most feature-rich and flexible testing framework anyway. You most likely won't need anything else...
Thomas Weller