Inconsitency in IActionResult return types #27832
Unanswered
bradford-dillon
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was writing unit tests on some controller logic and wanted to simply write some tests to check the status code returned in various situations. What I found was that some return types inherit from
StatusCodeResult
providing access to the status codes while others inherit fromActionResult
that does not have a set status code.This is easy enough to get around in unit tests as I can just test for
Assert.IsType
instead of directly checking the status code, but if I am testing for return codes elsewhere I would like to test for them everywhere for the sake of consistency.Is there some technical limitation that prevents things like
OkObjectResult
andForbid
from inheriting fromStatusCodeResult
or is it that way because of normal software development "stuff"?Beta Was this translation helpful? Give feedback.
All reactions