【发布时间】:2010-09-08 16:20:24
【问题描述】:
如何对 MVC 重定向进行单元测试?
public ActionResult Create(Product product)
{
_productTask.Save(product);
return RedirectToAction("Success");
}
public ActionResult Success()
{
return View();
}
Ayende's 方法仍然是最好的方法吗,预览 5:
public static void RenderView(this Controller self, string action)
{
typeof(Controller).GetMethod("RenderView").Invoke(self,new object[] { action} );
}
必须这样做似乎很奇怪,尤其是 MVC 团队说他们正在编写可测试的框架。
【问题讨论】:
标签: asp.net asp.net-mvc unit-testing