Search code examples
c#nunitvisual-web-developer

How can I set up an ASP .NET MVC application with NUnit unit tests in Visual Web Developer 2010 Express?


I understand that the Express edition doesn't template unit test projects... but being a complete newbie to Microsoft dev tools, I can't figure out how to set up the necessary things manually either. So could someone please walk me through how to get NUnit going?


Solution

  • It's actually quite simple:

    1. Download NUnit.
    2. Set up a new console application or class library in Visual Studio.
    3. Add a reference to the nunit.framework.
    4. Add a reference to the class library you want to test (put the code you want to test into a separate class library)
    5. Follow a tutorial on how to create your own tests.

    See this link for a sample MVC 1.0 project and sample templates, or this link for MVC 2.0 templates.