Asp.Net Action Filters - Can't test them? Stormwind comes to your help!
Once more my friend Claudio Figueiredo amazed me coming up with a brilliant solution to a problem that was starting to shadow an otherwise brilliant implementation of the MVC Pattern.
The new ASP.Net MVC Framework allows you to specify Action Filters. You can learn more about them in his post here (and check his solution to this problem as well).
These Action Filters are brilliant, in which they allow us amazing possibilities like logging actions when needed, caching Action Results, or anything that you can think in the ways of intercepting action calls.
The problem is (well, was) that they're not testable per se. The issue here being that currently the MVC Framework will not call them when you just create your own Controller in your test and call the action directly (which kinda makes sense).
So Claudio came up with a clever way of mimicking ASP.Net MVC's calls of the ActionFilters. If you call the action using his extension method, you'll get all the goodies that you would normally get from the framework.
Enough of reading my post! Go read his now!