Given an ASP.NET project with some files in the structure that have Content listed as their Build Action, how does one refer to that content in a manner that works both for IIS and Visual Studio's testing suite?
Our old/existing practice is to refer to the files using Server.MapPath():
String filename = HttpContext.Current.Server.MapPath("/common/template_1.txt");
However, this fails during testing. The test runner doesn't have an HttpContext.
Is there a mechanism for referring to /common/template_1.txt that will work with or without the HttpContext? Or do we need to fabricate an HttpContext?
If we need to replicate the Content items to the test, that's OK (though not ideal).