I have the files checked in to svn. The key is that I don't want to hardcode the paths to the files. How can I use relative paths and be able to find the data files consistantly?
A:
The best way to do this is as follows:
- Add a directory called "Test Data" to your VS2008 or VS2010 Test Project.
- Put your data file in that directory.
- In the properties for your data file, Set "Copy to Output Directory" to "Copy if Newer"
- Add this attribute to your test method: [TestMethod, DeploymentItem(@"Test Data\", @"Test Data\")]
- Your test data will be in the same directory as your assembly when you run the unit tests.
Cameron Peters
2010-03-02 21:11:48