Using content from the project in tests

Posted by oillio on Stack Overflow See other posts from Stack Overflow or by oillio
Published on 2010-04-27T18:06:43Z Indexed on 2010/04/28 19:27 UTC
Read the original article Hit count: 205

I am working with Visual Studio 2010 and it's integrated testing functionality.
I have an XML file in my project which is set to copy to the output directory. I can access the file just fine when I compile and run the project. But it doesn't exist when I attempt to access it within a TestMethod.

It looks like the test is run with the working directory set to an "Out" directory created within the TestResults directory. I can set a breakpoint before I use the file. If I then copy the file into this "Out" directory and continue running the test it accesses the file properly. But that is not really how I want my automated tests to function.

Is it possible to tell VS to copy the build directory into this working directory?

© Stack Overflow or respective owner

Related posts about visual-studio-2010

Related posts about unit-testing