How to make VS Unit Test show the Error Message from exceptions other than UnitTestAssertException?
I'm using VS Unit Testing Framework and Moq.
When a Moq verification fails, I'll get a Moq.MockException. In the Test Result开发者_开发问答s 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)?
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):
- Use ReSharper to run your tests.
- Use the free Gallio automation platform to run your tests.
HTH!
Thomas
精彩评论