I'm new with unit testing in visual studio and I want to load a physical xml file. This file is in the unit testing project as a Content and it's copied in the output directory.
So, when I compile the project, the xml file is in the output directory. But when I execute the test, a new directory is created with all dependent DLL, but the xml file isn't copied.
The content of the Xml is needed to execute the test. I execute this code to retrieve the path of the Xml file in the execution folder :
private static string GetXmlFullName()
{
// GetApplicationPath use the current DLL to find the physical path
// of the current application
string executeDirectory = AssemblyHelper.GetApplicationPath();
return Path.Combine(executeDirectory, "content.xml");
}
The exception is :
System.IO.DirectoryNotFoundException: 'd:\***\solutiondirectory\testresults\*** 2012-06-13 17_59_53\out\content.xml'.
How can I add this file in the execute folder?
Thanks in advance. (and sorry for my english ...)