How to validate your .NET Core WebAPI model and return a 400 (BadRequest) response from your controller and test it with Moq
I know, this is not a new question, however, if you search online you will mostly find articles writing about the older .NET Framework. Here is my way of dealing with 400 (BadRequest) and 404 (NotFound) errors with the latest .NET Core 3.0 WebAPI methods.
Read the complete article