Error using MVCContrib TestHelper
Posted
by Brian McCord
on Stack Overflow
See other posts from Stack Overflow
or by Brian McCord
Published on 2010-06-04T20:29:17Z
Indexed on
2010/06/05
6:32 UTC
Read the original article
Hit count: 254
While trying to implement the second answer to a previous question, I am receiving an error.
I have implemented the methods just as the post shows, and the first three work properly. The fourth one (HomeController_Delete_Action_Handler_Should_Redirect_If_Model_Successfully_Delete) gives this error: Could not find a parameter named 'controller' in the result's Values collection.
If I change the code to:
actual
.AssertActionRedirect()
.ToAction("Index");
it works properly, but I don't like the "magic string" in there and prefer to use the lambda method that the other poster used.
My controller method looks like this:
[HttpPost]
public ActionResult Delete(State model)
{
try
{
if( model == null )
{
return View( model );
}
_stateService.Delete( model );
return RedirectToAction("Index");
}
catch
{
return View( model );
}
}
What am I doing wrong?
© Stack Overflow or respective owner