【发布时间】:2013-01-17 13:53:37
【问题描述】:
我正在学习单元测试。如何使用 NUnit 和 Rhino Mock 对该方法进行单元测试?好吧,我已经测试了try 块并想测试catch 块的代码覆盖率。
[HttpPost]
public ActionResult AppraisalOrderIsAcceptedByEmployee(int appraisalOrderId)
{
try
{
this.appraisalOrderService.SubmitAppraisalOrder(appraisalOrderId);
}
catch (MessageLoneException ex)
{
// Display validation errors
PersistErrors(ex);
// Remains on the same view
return RedirectToAction("VerifyOrderDetails", new { id = appraisalOrderId });
}
return GetLoginRedirectCurrentUser();
}
【问题讨论】:
标签: c# asp.net-mvc-3 error-handling nunit rhino-mocks