如何在 Rhino Mock 测试中 RedirectToAction 后获取 TempData?
代码
public ActionResult Action1() {
TempData["Foo"] = "Bar";
return RedirectToAction("Action2");
}
public ActionResult Action2() {
return View();
}
测试
using (var controller = new TestController(x => x.Register(service))){
var result = (RedirectToRouteResult)controller.Action1();
// How to get TempData value there ?!
}