你的位置: 码友网首页 / 资讯源列表 / Unit Testing the HttpContext in Controllers

关于[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

收录时间: 2020-05-15 浏览量: 1521 分类: ASP.NET Core

| 0 收藏 | 0