I have a mock (using Moq) setup for a Mvc3 controller eg.
[TestMethod]
public void Step_One_Post_Should_Redirect_To_Step_Two()
{
// this test checks that when I submit a type parameter of StepOneModel and
// the next button was clicked Request["next"] , then goto Step Two
}
The only thing stopping this test running is the Save Method called from the controller, which fails as values aren't properly set in Session in this test context. Really I want to omit this database call from this unit test.
Basically how do I stup/mock the Save(model) call from the controller action?
[HttpPost]
public ActionResult Index(IStepViewModel step)
{
// after model is deserialized
if (!string.IsNullOrEmpty(Request["next"]))
{
Save(model) <-- the bit blocking me
}
return View(model) <-- the bit I want to assert against
}