How to unit test whether a Core MVC controller action calls ControllerBase.Problem()
问题 We have a controller that derives from ControllerBase with an action like this: public async Task<ActionResult> Get(int id) { try { // Logic return Ok(someReturnValue); } catch { return Problem(); } } We also have a unit test like this: [TestMethod] public async Task GetCallsProblemOnInvalidId() { var result = sut.Get(someInvalidId); } But ControllerBase.Problem() throws a Null Reference Exception. This is a method from the Core MVC framework, so I don't realy know why it is throwing the