【发布时间】:2015-02-06 16:06:20
【问题描述】:
我正在测试一个控制器是否没有参数,它应该重定向到动作"Index"。
// Controller code
return RedirectToAction("Index");
// Unit test code
ActionResult result = Controller.Action(null);
Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));
Assert. // HERE i need to test it is going to Index, how do I do that?
【问题讨论】:
-
RedirectToRouteResult 有属性
public RouteValueDictionary RouteValues { get; private set; }你可以检查。
标签: asp.net asp.net-mvc unit-testing tdd