Given the following controller class:
public class ProjectController : Controller
{
public ActionResult List()
{
return View(new List<string>());
}
}
How can I get a reference to the model object in the following unit test?
public class ProjectControllerTests
{
private readonly ProjectController controller;
public ProjectControllerTests()
{
controller = new ProjectController();
}
[Fact]
public void List_Action_Provides_ProjectCollection()
{
var result = (ViewResult)controller.List();
Assert.NotNull(result);
}
}
I have tried stepping into the controller action to see what internal fields were being set, but with no luck.
My knowledge of ASP.NET MVC is pretty limited, but my guess is that I am not setting up the controller with a correct context.
Any suggestions?