Anthony
Anthony

Reputation: 437

unit test to use actual classes and not copies of classes

I'm currently creating unit tests for some classes/module in a much bigger system software, using Visual Studio 2008. The source files of the classes are stored in one repository. Of course, whenever I would test these classes, I would have to include them in the project by selecting the "Add Existing Item" so that I would have an exact copy of the class that I would get to test. This makes VS2008 make its own copy of the class. But the thing is, requirements suddenly have changed in that I have to use the actual classes themselves, and not copies of them (like, put a reference in the test project), so that whenever the classes would be edited/changed/updated, the unit test would surely fail. I can't seem to find any options wherein I'd place a reference to the actual classes in the test project, and from there, I'd create the unit test. Is there any way wherein I could test the actual classes themselves?

Upvotes: 2

Views: 274

Answers (1)

Oscar Mederos
Oscar Mederos

Reputation: 29803

The key is to add the files as a link (something like a shortcut):

Add Existing Item > Add As Link

See the screenshot:

enter image description here

That way Visual Studio won't make a copy of the files, and if you change them in the original source, they will also be modified in your Solution.

Upvotes: 2

Related Questions