Unit testing with multi-project solution question.


G

Guest

Hi,

Currently, I've got all my unit tests in a separate class in the same
project.
Instead of this, I'm planning to move all my tests in a separate project
in a single
solution.

For example let "TargetProject" is the main project in a solution. My plan
is to have another project, for example "TestTargetProject" that will
contain all
the unit tests ,in the same solution. Is this o.k. to do.

while doing this, I have created a new project(empty project) for my unit
tests
and added a C# file with my tests but I couldn't build the solution. When I
tried to
add a referece of the target project to the new test project, it is
accepting only .dll
files but not .exe files.

All my target project are of type either "console applicaitons" or
"windows applications" that produce .exe but not .dlls. In this case do I
need to
rebuild all of them to produce a .dll.

Is there any way I can add referece of the target projects to the test
projects.
Kindly let me know.

I'm using C#.NET

Cheers,

Naveen.
 
Ad

Advertisements

A

Alan Pretre

Naveen Mukkelli said:
Currently, I've got all my unit tests in a separate class in the same
project.
Instead of this, I'm planning to move all my tests in a separate project
in a single
solution.

Yes you have a problem. The other problem you will have is being able to
test private methods of TargetProject.

IMO it is best to leave your organization as is.

-- Alan
 
Ad

Advertisements

N

Nick Malik [Microsoft]

From what I've heard, in Whidbey, you can make a reference to an EXE but not
in the current version of Visual Studio.

You can either break your EXE app into an EXE and a DLL, and then have your
unit tests simply test the DLL, or you can leave the unit tests in your EXE
and set up the Release compilation to exclude the unit test classes.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top