Unit testing: how to access a text file?
You have to add the DeploymentItem attribute to your test class. With this attribute you specify the files which are copied into the out directory for the test run. For example: [TestMethod] [DeploymentItem(@”myfile.txt”, “optionalOutFolder”)] public void MyTest() { … } See also: http://msdn.microsoft.com/en-us/library/ms182475.aspx.