How do I exercise an action to ensure it redirects to the correct action or route?
+4
A:
public ActionResult Foo()
{
return RedirectToAction("Products", "Index");
}
[Test]
public void foo_redirects_to_products_index()
{
var controller = new BarController();
var result = controller.Foo() as RedirectToRouteResult;
if(result == null)
Assert.Fail("should have redirected");
Assert.That(result.RouteData.Values["Controller"], Is.EqualTo("Products"));
Assert.That(result.RouteData.Values["Action"], Is.EqualTo("Index"));
}
Ben Scheirman
2008-08-28 14:47:08
A:
Do not route truck on to eagle bend road in clinton tenn, this is a no trucks route. This is a narrow road that is not made for big riggs. A accident waiting to happen.
donnie rosenbalm
2010-07-06 15:21:20