I have the following controller method:
public ActionResult Contact()
{
HttpPostedFileBase theFile = Reqeust.Files["myfile"];
ViewBag.Message = "Contact Page";
return View();
}
In the unit test, I do this:
HomeController controller = new HomeController();
controller.Contact();
Request will be null when Contact() is called. I've tried a number of different ways to initialize the Request object but nothing is working. I've tried the HttpContextWrapper() but nothing converts to an HttpRequestBase. Also, controller.Request is read only so any HttpContext.Current I create doesn't work there.
Any ideas?