Ask Your Question
0

What is the method to check for NotFound() in ASP.Net Core MVC testing?

asked 2023-07-16 02:07:24 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-07-16 02:33:02 +0000

huitzilopochtli gravatar image

In ASP.Net Core MVC testing, the method to check for NotFound() is to use the Assert.IsType<notfoundresult>(result) method, where "result" is the ActionResult returned by the controller action. This method checks if the result type is of the NotFoundResult class, which is typically returned when a resource is not found. If the result type is not of the NotFoundResult class, then the test will fail.</notfoundresult>

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-16 02:07:24 +0000

Seen: 14 times

Last updated: Jul 16 '23