Do you like to separate out your unit tests from the project you are testing? I imagine so. My own practice when creating a new project in Visual Studio is to create a separate unit test project alongside whose responsibility is to house unit tests for that new project.
This post will set out:
- How to achieve this *without* having to include your tests as part of web project.
To do this I will lean heavily (that's fancy language for "rip off entirely") on an excellent blog post by Mathew Aniyan which covers point #1. My contribution is point #2.
First of all, install Chutzpah on TFS / VSO. You can do this by following Steps 1 - 6 from Mathew Aniyan's post. Instead of following steps 7 and 8 create a new unit test project in your solution.
Edit 29/05/2014: Matthew Manela (creator of Chutzpah) has confirmed that this is the correct approach - thanks chap!
@johnny_reilly Nope that is pretty much what you need to do.
— Matthew Manela (@mmanela) May 15, 2014
Import Project statement:
Ordering is important in this case. It matters that this new statement sits after the other
Import Project statements. So you should end up with a csproj file that looks in part like this: (comments added by me for clarity)