Write Unit tests into an assembly or in a separate assembly?

后端 未结 5 789
轮回少年
轮回少年 2020-12-16 13:08

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

5条回答
  •  不思量自难忘°
    2020-12-16 13:35

    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 doesnt reference Tests so it doesnt get compiled in.

    Edit: The bottom line is really that you dont 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 :)

提交回复
热议问题