How to copy data-files to the TestResults folder of your MSTest unit-tests
When running unit-tets you will often want to read data from .txt or .xml files. On the runtime, these files have to be copied to the TestResults folder. By choosing
Copy to Output Directory: Copy always or
Build Action: embedded Resource for these files will not help and the file is not found when the unit-test runs.
You will have to update the
.testrunconfig file which contains the configuration of your unit-tests and add a new entry for
DeploymentItem like the following example:
<DeploymentItem filename="PATH_TO_YOUR_DATA_FILE" />