Module 08 of 10

Testing & CI/CD

Lessons

About This Module

Writing code that works today is only half the job. You also need to know it still works after the next change, and you need a reliable way to get it from your machine to production. Automated tests and a CI/CD pipeline give you both, and teams expect them in almost every professional .NET project.

You'll start with unit testing using xUnit, then learn to isolate the code under test by mocking dependencies with Moq. Next comes integration testing a Web API with WebApplicationFactory, and finally continuous integration and delivery with GitHub Actions, where your build and tests run automatically on every push.

With tested, automatically built code, you'll be ready for the next module, Razor Pages & Blazor, where you build user interfaces with .NET.

Lessons

4 videos
01

Unit Testing in ASP.NET Core with XUnit

A tutorial on applying test-driven development to a C# .NET Core project with the xUnit testing framework, with source code available to follow along.

02

Make Your C# Unit Tests 10x Better With Moq - An Easy Mocking Tutorial for Beginners in .NET!

A beginner-friendly look at Moq: what mocking is and why it matters, how to mock dependencies, how to write testable C# code, and best practices for unit testing with mocks.

03

Let's Integration Test .NET Web API w/ WebApplicationFactory!

Shows how to integration test a Web API with WebApplicationFactory: setting up the test project, sending a GET request to an endpoint, and deserializing the response into a C# model to assert on the results.

04

GitHub Actions for .NET: Build → Test → Publish in ONE ci.yml

Builds a test-gated CI/CD pipeline for a .NET 10 Web API in a single GitHub Actions workflow: caching NuGet packages, building in Release, running tests as a gate, publishing artifacts, and deploying only when tests pass.