I have a GlobalExceptionHandler which handles all the exceptions of a WebAPI in a central way. I need to add some unit tests to make sure that the exceptions catched by this class generate the Results in the correct format.
In web config, I have this : config.Services.Replace(typeof(IExceptionHandler), new GlobalExceptionHandler()); which works perfectly.
I do the same thing when configuring a controller for unit test. But when calling the controller methods from unit tests, the exception is not catched by GlobalExceptionHandler. What step am I missing ?
Aucun commentaire:
Enregistrer un commentaire