I have an action method as below
[HttpPost]
public ActionResult Index(HttpPostedFileBase file)
{
//do something
return View();
}
and front end is
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" id="filesUpload" />
<input type="submit" value="Upload File" />
}
Well, my code just work fine. But I want to write an unit test for the action method void Index (HttpPostedFileBase file)
. Where I want to pass the file as the way we got from UI form post. How can I do it.