views:

31

answers:

0

I'm just starting to use MVCContrib, and I'm really liking the syntactic sugar it adds to various test scenarious. For example, I just wrote this assertion:

"~/".Route().ShouldMapTo<SpotController>(c => c.List());

It's brilliant! Well, almost...

Instead of, as I'd like, seeing the actual reason why the test fails (I've changed nothing in my MVC application, so that should route to HomeController.Index()) I get the generic message about an exception being thrown during test execution. This is, I find when I debug, because the test extension method in MVCContrib correctly (?) throws an AssertionException.

I assume this is the NUnit type of failure exception, while the MsTest version is AssertFailedException. Since the NUnit version (obviously) does not inherit from the MsTest version, the test runner in VS doesn't catch the exception and give me a nice message.

Is there any way to get MsTest to treat AssertionExceptions in a similar manner as AssertFailedExceptions, without having to re-write half of MVCContrib.TestHelpers?

I do have the source code in a local working copy, so I could go in and re-write the test methods there to throw MsTest exceptions instead, but it seems like extreme overkill...

Update:
This problem appears with most mocking frameworks too, so now I don't only want to do this with the AssertionException from NUnit, but also with VerificationException from Moq, and possibly others... Is it just not possible?