Unit test use actual classes, not copies of classes

I am currently creating unit tests for some classes / modules in much larger system software using Visual Studio 2008. The class source files are stored in a single repository. Of course, whenever I tested these classes, I would have to include them in the project by selecting “Add an existing item” so that I would have an exact copy of the class that I would test. This makes VS2008 its own copy of the class. But the fact is that the requirements have suddenly changed that I have to use the classes themselves, and not their copies (for example, put a link in a test project), so whenever the classes are edited / modified / updated, unit test will surely fail. It seems I can’t find options in which I would place a link to the actual classes in the test project,and from there I would create a unit test. Is there a way I could test the classes themselves?

+2
source share
1 answer

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

Add Existing Item > Add As Link

See screenshot:

enter image description here

This way, Visual Studio will not make copies of the files, and if you change them in the original source, they will also be changed in your solution.

+2
source

All Articles