我有一個Action
如下:我該如何測試返回PartialViewResult的MVC Action?
public PartialViewResult MyActionIWantToTest(string someParameter)
{
// ... A bunch of logic
return PartialView("ViewName", viewModel);
}
當我檢查的結果,它有幾個屬性,但它們要麼是空,或空。 有任何東西的唯一財產是ViewEngineCollection
它不包含任何特定於我的方法。
有沒有人有一些示例代碼,測試PartialViewResult
?
另外MvcContrib.Testhelper有一個AssertPartialViewRendered()擴展方法。 – mxmissile 2010-12-20 21:49:16
哇 - 謝謝,我不能相信我錯過了! – Robert 2010-12-21 19:53:40