If you want to test template you have to execute ExecuteResult
of the ViewResult
. The problem is ControllerContext
that you have to pass to this method. You have to mock too many stuff. You can look for test helpers in MvcContrib. They prebuilt some mocks.
On the other hand, probably this is not good idea. In most cases it’s better to cover such stuff with integration tests. Even simple request to the url will give confidence that template is successfully compiled.