I\'ve a method. which retrieve a document from hard disk. I can\'t test this from unit testing. It always throw an exception invalid null path or something. How to test that
If you need to test legacy code which you can't or don't want to change, you can try FakeHttpContext.
This is how it works:
var expectedPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "path");
using (new FakeHttpContext())
{
var mappedPath = Http.Context.Current.Server.MapPath("path");
Assert.Equal(expectedPath, mappedPath);
}