Unit testing MVC.net Redirection
        Posted  
        
            by Dan
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Dan
        
        
        
        Published on 2008-09-12T08:38:29Z
        Indexed on 
            2010/06/16
            22:12 UTC
        
        
        Read the original article
        Hit count: 314
        
How do I Unit Test a MVC redirection?
public ActionResult Create(Product product) { _productTask.Save(product); return RedirectToAction("Success"); } public ActionResult Success() { return View(); }
Is Ayende's approach still the best way to go, with preview 5:
 public static void RenderView(this Controller self, string action) 
 {
    typeof(Controller).GetMethod("RenderView").Invoke(self,new object[] { action} ); 
 }
Seems odd to have to do this, especially as the MVC team have said they are writing the framework to be testable.
© Stack Overflow or respective owner