When writing Unit tests, it is sometimes useful to use specific files for a specific Unit test. With help of the TestContext object in a Unit test class you can easily deploy files along with your Unit Tests.
Everytime a Unit test is executed, the file(s) is published to an output Directory. This file can then be used for your Unit test.
The files that you want to deploy must be set to “Copy Always” in the properties window.
Then it should work.
But!!!! In VS 2010 a setting is disabled where it was enabled in VS 2008. Deployment of files is now default switched off!
In order to switch it on go to Menu | Test | Edit Test Settings and select the active one (Test | Select Active Test Settings)
Click Deployment and Check the box!
Happy Testing !