How to unit test action methods with HttpContext, Request, ModelState — We do different levels of tests against controllers. When unit testing controller logic, the test only executes the action method itself without going through the framework’s request/response pipeline. In other words, the filter attributes (e.g., the Authorize attribute ), model binding, and middlewares do not affect unit tests for controllers…