I have written a unit test that uses a CSV file to read in data using the "DataSource" and "DeploymentItem" Attributes pointing to a CSV file in a subfolder. However, when initially building the project the files are deployed to two different locations, one in the root and the other in the subfolder (Which I now figured is because of Resharper apparently doing it's own copy into root).
When I then later change the CSV file with different data and save and re-build the project (having the CSV property "Copy to Output" set to "Copy always", just to make sure), it copies the changes to the correct output subfolder but not the root. When running unit tests using the Resharper test runner, it therefore still reads in old data because it picks the CSV file up from the root and not the subfolder (and doesn't update it when the file gets modified). So each time I have to go to the output folder and copy the CSV file from the subfolder into the root folder for the test to pick up the changes.
At first I thought it was a VS issue but after running the tests using Visual Studios' own runner it worked fine, but the Resharper test runner continues picking up the wrong unmodified CSV file it initially copied into the root folder.
Does anybody know how to fix this so the test looks in the subfolder to pick up the CSV file and not the root? I played around with various DeploymentItem settings, even trying to use the full path as the output directory, but nothing worked so far. Not sure what I'm missing here.
[TestMethod()]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", @"|DataDirectory|\\Data\MyData.csv", "MyData#csv", DataAccessMethod.Sequential)]
[DeploymentItem("MyApp\\MyTest\\MyTests.Tests\\Data\\MyData.csv")]