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 HttpGet API endpoint - ASP.NET Core Tutorial
From the course: Advanced ASP.NET Core: Unit Testing
Unit testing HttpGet API endpoint
- [Instructor] We are going to follow a simple rule or flow and that is arrange, act, assert. But, what does this mean? Well, with arrange we mean that we need to arrange or set up the necessary parameters for the test. When we used the fact attribute for example, this happens inside the methods. And when we used the theory attribute, this happens in the InlineData, MemberData, or ClassData attributes where we provide the parameters. Act means just do the action which might be calling a method, calling a controller, et cetera. Now that we have the parameters or no parameters and we act it is time to assert or in other words evaluate the result. Well, let's go to visual studio and write our fist unit test. And you'll go to the Books Controller Test file and we are going to unit test the first API endpoint of the Books Controller. So if we go to Books Controller by right-clicking then Go To Definition, we are going to see…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
ASP.NET Core web API project overview2m 57s
-
(Locked)
Set up web API testing project3m 13s
-
(Locked)
Unit testing HttpGet API endpoint5m 29s
-
(Locked)
Challenge: Test HttpGet API endpoint with id51s
-
(Locked)
Solution: Test HttpGet API endpoint with id7m 35s
-
(Locked)
Unit testing HttpPost API endpoint6m 37s
-
(Locked)
Unit testing HttpDelete API endpoint4m 38s
-
(Locked)
-
-