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 discussing the older .NET Framework. Here is my way of dealing with 400 (BadRequest) and 404 (NotFound) errors using the latest .NET Core 3.0 WebAPI methods.
Read the complete article