views:

8

answers:

0

How do I access the current project directory in a unitest?

I would like to test a controller that accesses user generated files. In the controller, I use Server.MapPath("~/Uploaded") which works great. However, that doesn't work for the unittest.

I understand that I probably have to mock HttpContext.Server.MapPath but to what? Do I have to hardcode the entire path?

Incidentially, what is the standard place to put supporting files (test.txt, test.gif, etc.) for unittests to use?

Thanks!