0

I have some method which read the file by the path HostingEnvironment.MapPath("filepath"). From unit test HostingEnvironment.MapPath always returning null.

How can i setup the mock requestcontext to return proper file path in web api controller 2?

sacratees
  • 225
  • 1
  • 2
  • 6
  • Change design to avoid tightly coupling to statics – Nkosi Jul 15 '19 at 21:43
  • Similar https://stackoverflow.com/questions/38452743/how-to-avoid-httpcontext-server-mappath-for-unit-testing-purposes/38456288#38456288 – Nkosi Jul 15 '19 at 21:58

0 Answers0