.NET 5 REST API Tutorial 10 – Unit Testing and TDD
Julio Casal
✅Check the .NET 8 Full Course: https://youtu.be/AhAxLiGC7Pc
💻Get the source code: https://go.dotnetacademy.io/net5restapi-10
Topics covered:
00:00 Video overview
00:41 What is Unit Testing?
04:56 What is Test Driven Development (TDD)?
07:12 Unit testing frameworks in .NET
08:02 Moving the REST API to its own directory
12:02 Creating the xUnit test project
12:52 Building multiple projects in VS Code via build.proj
18:13 Adding the test class
19:48 Adding tests for GetItemAsync
22:12 The AAA pattern
23:11 Adding stubs via the Moq framework
30:29 Running tests in VS Code
31:42 Using the .NET Core Test Explorer extension
41:38 Comparing object properties via FluentAssertions
45:22 Testing GetItemsAsync
49:19 Testing CreateItemAsync
54:38 Excluding missing members when comparing objects
56:50 Testing UpdateItemAsync
1:01:29 Testing DeleteItemAsync
1:03:34 Switching Item from record to class and adding Description
1:04:54 Switching DTOs to positional records
1:07:50 Fixing the code base
1:11:07 Fixing a failing test
1:14:27 Using TDD to add a new feature
1:15:41 Adding a test before implementing the new functionality
1:20:59 Auto generating the new method to implement
1:22:47 Getting green by implementing the new functionality
1:24:56 Verifying the new feature via Postman
🔥Become a Senior C# Backend Engineer: https://juliocasal.com/courses
🗺️Get My Free .NET Backend Developer Roadmap: https://juliocasal.com/roadmap
Join me on Patreon: https://www.patreon.com/juliocasal
Follow me on LinkedIn: https://www.linkedin.com/in/juliocasal
Follow me on X: https://x.com/julioc
#dotnet #restapi #tutorial