tags:

views:

191

answers:

2

I have created a custom action filter (attribute) that hits a database. How can I unit test the controller actions by injecting a mock repository (so that it doesn't actually hit the database for the unit test) for the action filter to use?

A: 

I had the same question a couple of weeks ago.

http://stackoverflow.com/questions/609942/unittest-actionfilter

At the end I accepted that I have to test the controller without the filter and test the filter itself.

Malcolm Frexner
Thanks for the info but it does not explain how the action filter can work with a mock repository that I can inject from the unit test.
A: 

Thanks for the info but it does not explain how the action filter can work with a mock repository that I can inject from the unit test.