I am working with XDocument in the MVC4 Web API application in Visual Studio 2010 and am not sure about the testing strategy.
Most of my unit tests use XDocument memory, which works well for controller, service, repository tests.
However, I have scripts XDocument.Load(filename)and XDocument.Save (filename) that I would like to test (using unit tests or integration).
I looked at the following question \ answer on here here , but I'm not sure how to proceed.
public class PathProvider
{
public virtual string GetPath()
{
return HttpContext.Current.Server.MapPath("App_Data/policies.xml")
}
}
PathProvider pathProvider = new PathProvider();
XDocument xdoc = XDocument.Load(pathProvider.GetPath());
So, I realized that now I can mock calls of any calls to XDocument.Load (pathProvider.GetPath ()).
Should I try to check if PathProvider is working? If so, how would I approach this?
thank
Davy