Closed Samuel-Langlois-BimOne closed 2 years ago
@Samuel-Langlois-BimOne Sorry for being so slow answering this, but I think that's Alba working exactly as expected. Try:
return Application.AlbaHost.Scenario( => { .Get.Url("/Hub"); ..StatusCodeShouldBe(500); });
with the exception middleware on.
@Samuel-Langlois-BimOne I played with this a bit today. I think there's something else going on in your middleware that was making Alba wonky with the response body. Regardless, I hardened the area of the Alba code that was throwing during the assertion message to stop this from happening again. I did verify that the status code assertion is working at least.
@jeremydmiller Thanks for checking. Not sure what was going on, but it turns out that just upgrading to .NET 6 fixed the issue 😮. I also upgraded to the latest Alba version and everything works well !
I'm trying to test an action which throws an exception. I would have expected that I could run the scenario and check for the response code (500 or otherwise), but the test fails before that.
In the test I just get the URL:
The tested action just throws an error
Here is the call stack.
I use an exception handler middleware. I tried without it, and it throws the NotFoundException directly instead, but it still throws an exception.
Tested with Alba 5.0.1