关于[Unit Testing the HttpContext in Controllers]的摘要:
When it comes to unit testing, it is common to use mocking to replace “external” services, that is, those that are not part of the subject under test. Not everything can be mocked, and, sometimes, when we instantiate non-POCO classes, such as controllers (ControllerBase), there are lots of things that are not instantiated by the framework and are left for us do to. Just think, for example, if you want to access request or quest string data or know if the user is logged in? In this post I will talk about two things: the user identity and the request data.
原文地址: https://weblogs.asp.net/ricardoperes/unit-testing-the-httpcontext-in-controllers