From the course: Advanced ASP.NET Core: Unit Testing

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Unit testing remove ActionResult

Unit testing remove ActionResult - ASP.NET Core Tutorial

From the course: Advanced ASP.NET Core: Unit Testing

Start my 1-month free trial

Unit testing remove ActionResult

- [Instructor] So far, we have tested features like, listing all books, creating new books, and showing the details of a single book, there is one more feature that we are missing for the unit test project to be completed, and that is deleting a book from the library. So let's go to Visual Studio and see this in action, go to the books controller test, and scroll to the bottom where we are going to create our new test. So in here, I'll just write theory, and then InlineData, because this actual result takes as a parameter, of book ID. So next, that is just write public void DeleteTest. Here we are going to have the string validGuid. And you will see that we get an error because we provided a parameter for the DeleteTest method, but we didn't provide any parameters in the InlineData attribute. So I'll just scroll up in here, go to the DetailsUnitTest, and copy this string value, then scroll down and paste it in here inside brackets,…

Contents