How can I use an external data file in unit tests of Visual Studio? If I try to just include it in a test project and set Copy To Output Directory to true, it still cannot be found.
I have:
[TestMethod]
public void DoMyTest() {
using (StreamReader rdr = new StreamReader("MyTestData.txt")) {
blahblah
}
}
However, the file does not exist, so I get an exception. My test data does not match well with XML or CSV, so using DataSourceAttribute is not a viable option.
source
share