MVC .NET How to add unit test project in for existing source code?

Viewed 26052

I've already created MVC project (VS2008 .NET 3.5) at first time VS2008 ask me "Would you like to create Unit test project for this application ?" I choose No..

Now I realize that it's growing more complex and TDD (test driven development) approach would have been better.

but can't find out how to add a unit test project in my solution?

4 Answers

Maybe this will help you

How to: Create a Test Project

As described in the following procedures, you can create test projects in several ways:

Just use Add -> New Project

Either add a simple Class Library, and manually add a reference to the unit test framework of your choice, or use the "Unit test project" template that comes with visual studio (for use with MSTest)

If I remember correctly, the generated unit test project has some example tests for the default project controllers, etc..

If you want to use the generated unit test project as a starting point, you could always create a new ASP.NET MVC solution, select 'Yes' this time, and then copy that into your project. You'll have to update the references to correctly point to your project of course..

Related