In both VSTS 2008 and VS 2010 RC1 when I create a Unit Test (mstest), I am not asked where I would like the project to be placed. It will always turn up at the Solution level. I would like to place the test project inside the folder of the class(es) that are being tested.
I have tried unloading the unit test project and adding it to the class library, but that breaks the coupling with the class.
I am using Visual Studio 2010 Ultimate RC1 with ReSharper 5.0 and Visual Stuido 2008 with RS 4.5.
TIA,
Jim
Amended: I was not at all clear about placing the unit tests. I have a Solution with several Solution Folders. One of these is a common library. I would like to add unit tests for some classes in the library. VS will place the TestProject at the base Solution level. I would prefer
mySolution
mySolution\SolutionFolder
mySolution\SolutionFolder\ClassLibrary
mySolution\SolutionFolder\ClassLibrary\Class1.cs
mySolution\SolutionFolder\ClassLibrary\Class2.cs
mySolution\SolutionFolder\UnitTestForClass1
mySolution\SolutionFolder\UnitTestFOrClass2
Instead, VS will do:
mySolution
mySolution\SolutionFolder
mySolution\SolutionFolder\ClassLibrary
mySolution\SolutionFolder\ClassLibrary\Class1.cs
mySolution\SolutionFolder\ClassLibrary\Class2.cs
mySolution\UnitTestForClass1
mySolution\UnitTestFOrClass2
I hope this is clearer. Thank you.
I do apologize for all the miss-edits I have posted.
The normal practice is to segregate byb source/source and source/test at the highest level.
In other words, suppose you have a “solution” with 3 projects, each of which builds a distinct assembly. You might have a source tree like this:
The test code would normally be like this:
This is independent of Visual Studio or mstest. This is just how I have seen it done, pretty much everywhere.