Relative Content

Tag Archive for c#unit-testingcqrsbad-request

.NET 8 C#: writing unit test case for BadRequest?

I’m working on an ASP.NET Core 8 Web API with CQRS mediator pattern and I’m currently creating tests for all the controllers. Everything’s working fine, expect I cannot create tests for BadRequest responses, as the client which calls the controller throws a “Bad Request” exception without allowing me to control it.

.NET 8 C#: writing unit test case for BadRequest?

I’m working on an ASP.NET Core 8 Web API with CQRS mediator pattern and I’m currently creating tests for all the controllers. Everything’s working fine, expect I cannot create tests for BadRequest responses, as the client which calls the controller throws a “Bad Request” exception without allowing me to control it.