.Net provides a useful FileWebRequest
class to let you perform web-requests on a local file, and the very handy WebRequest.Create(uriString)
method which returns the right type of object depending on the URI type (file, http, etc).
However what if I want to run a test which uses a file with a relative local path? I'm fairly sure a file URI mustn't be relative (from my tests and other SO answers) so what is the right approach here?
I see .NET can do the opposite through URI.LocalPath
: https://msdn.microsoft.com/en-us/library/system.uri.localpath(v=vs.110).aspx