I have a test project and I'm using MSpec for some of the tests (mixed project with both MSpec and VSTest). I have a method that operates on a text file and requires a path to the file. My problem is that the current directory for the file doesn't include the file I need. I have the file included in my project, marked as content & "copy always".
After the test run I can see the file in the TestResults/[timestamped folder]/Out
directory. However, if I debug the test and check Path.GetFullPath("resources\\myfile.txt")
in the immediate window it returns:
"C:\\Users\\[username]\\AppData\\Local\\Temp\\cb44d906-d20b-4bfb-9569-c661986eb902\\cb44d906-d20b-4bfb-9569-c661986eb902\\assembly\\dl3\\5e87e3e4\\e2bffa3c_7daacf01\\resources\\myfile.txt"
Am I using MSpec wrong? Or am I just missing some configuration?
Visual Studio 2013, runner: ("MSpec Test Adapter" VS extension by Eugene Duvenage)