views:

64

answers:

2

Creating Unit Tests in VS2008 (rightclick, create unit tests) causes a lot of references to be added to my testproject. These are the same references that the project being tested is using.

Why is this necessary? Is there an option somewhere to turn it off?

+3  A: 

Some types being tested might expose public members with their parameters and/or return types defined in other assemblies. The tester assembly requires to know about them to be able to test those members. This is accomplished by referencing all the assemblies referenced by the assembly being tested.

Mehrdad Afshari
A: 

If you're worried about extra references, I would everything manually. For each project Foo you might have, create another project FooTests.

Then you'd only need to add in a reference to Foo, and say NUnit, then hopefully it will become obvious which additional references you need to add. ReSharper does a great job of this and being very clear about what you need to add.

Right click -> Create unit tests is a feature new to VS2008. So it might not be perfect yet.

IainMH