"The Razor parser and view engine can be instantiated and used outside of the ASP.NET application domain. This means you can directly instantiate and use it within a unit test project without any dependencies on running ASP.NET"
Any ideas how can I do it ??
What I did was to create a unit test project and then added the mvc project into the reference. Then I instantited the controller object and invoke its action method.
You should be able to do assertion to check the contents of the view.
I think the easiest way to do is to create a new dummy mvc 3 project with a unit test project come with it. It will create an example Test Method for you.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With