views:

82

answers:

3

I have an infrastructure library which must be used from both WinForms and ASP.Net.

I would like to wrap this up in some unit tests.

Which project do I put these in?

Do I use another folder in my library project? A different solution which contains only my infrastructure project and a separate unit testing project?

Incidentally, I will be using the ReSharper test runner, if that makes any difference.

Also, this library sits on top of NHibernate, if that makes any difference either.

+6  A: 

I would create a separate project containing only your tests. Reference your infrastructure project from the testing project.

It doesn't make much sense to ship your production code out with your unit tests, even if they are not accessed via the winform or web interface.

Additionally, consider using MVP architecture pattern with Dependency Injection to organize your classes and make your presenter and other components more test friendly.

MedicineMan
+1 - beat me to it...
John Rasch
A: 

Put your tests in a separate project altogether, and you can include that project in your WinForms solution and your ASP.NET solution.

John Rasch
A: 

I not only create a separate project for my tests, I further divide them into separate projects for unit and integration tests.

This way you can configure your continuous integration server to only run the unit tests on check in, and then run both sets of the tests for the nightly build.

Mark Rogers