Including Tests into the Original Assembly
I am working on a project in which I am diligently applying TDD. I am enjoying the process of actually driving my design with tests, as it as clearly saved my bacon already with discovering bugs in my class constructors. I am using ReSharper’s NUnit support + Matt Berther’s excellent TDD Live Templates over MSUnit, which is a whole post in itself.
As you can see in the image to the right, I have embedded the actual test fixtures into the original assembly. For the first few days of this project, I was managing a separate project and assembly for unit tests, but I finally decided it makes more sense to keep the tests near the original class files.
- It doesn’t swell the physical size of the assembly my much.
- I may embed a unit test runner function into the Help menu of the final application. This will be enormously helpful for troubleshooting and support.
- Management of the tests is easier because it requires future developers to load on fewer project.
For now, I have chosen to put my tests into a separate folder within the project. This separates the test classes from the other classes in the assembly by a namespace and that makes sense to me for the time being. Alternatively one could have a ClassTest file next to each Class file.


