ASP.NET MVC unit test controller with HttpContext

前端 未结 5 1323
攒了一身酷
攒了一身酷 2020-11-28 07:21

I am trying to write a unit test for my one controller to verify if a view was returned properly, but this controller has a basecontroller that accesses the HttpContext.Curr

5条回答
  •  执念已碎
    2020-11-28 07:33

    I'd checkout the ASP.NET-MVC book listed here -- toward the end, there is a good section on Mocking framewors -- http://www.hanselman.com/blog/FreeASPNETMVCEBookNerdDinnercomWalkthrough.aspx

提交回复
热议问题