我需要测试在方法列表中调用了特定的 Func,例如:
public class ProductController : BaseController
{
private readonly Func<IProductRepository> prodRepo;
public ProductController(Func<IProductRepository> _prodRepo)
{
prodRepo = _prodRepo;
}
public ActionResult List(string applicationID)
{
var products = prodRepo().GetForApp(applicationID).ToList();
return PartialView("_List",products);
}
}
在这种情况下,我需要验证是否调用了prodRepo().GetForApp(applicationID)。