When writing unit tests, do you place your tests inside the assembly you wish to test or in a separate test assembly? I have written an application with the tests in classes in a separate assembly for ease of deloyment as I can just exclude the assembly. Does anyone write there tests within the assembly you wish to test and if so what is the justification for it?
Share
I have a single solution with an interface project, a tests project, a domain project and a data project. When I release I just publish the interface, which doesn’t reference Tests so it doesn’t get compiled in.
Edit: The bottom line is really that you don’t want it to be part of your final release. You can achieve this automatically in VS by using a separate project/assembly. However you can have it in the same assembly, but then just not compile that code if you’re using nant or msbuild. Bit messy though, keep things tidy, use a separate assembly 🙂