Unit Testing an ASP.NET Core Web API
by Kevin Dockx
- Course Overview
- Coming Up
- Positioning This Course
- Course Prerequisites
- Frameworks and Tooling
- Demo - Introducing the Demo Scenario
- The What, Why, and What Not of Unit Testing
- Comparing Unit Tests, Integration Test, and Functional Tests
- Demo - Adding a Unit Test Project
- Demo - Writing Your First Unit Test
- Naming Guidelines for Unit Tests
- The Arrange, Act, Assert Pattern
- Comparing xUnit, NUnit, and MSTest
- Summary
- Coming Up
- Learning About Assertions
- Demo - Asserting on Booleans
- Demo - Asserting on Strings
- example of how to make Assert.Equal case insensitive
- Demo - Asserting on Numeric Values
- Demo - Asserting on Floating Points with Precision
- shows how to specify precision when using Assert.Equal with floating numbers
- Demo - Introducing a Repository Implementation with Test Data
- Demo - Asserting on Arrays and Collection Content
- Demo - Asserting Asynchronous Code
- Demo - Asserting on Exceptions
- Demo - Asserting on Events
- Demo - Asserting on Object Types
- Asserting on Private Methods
- Summary
- Coming Up
- Setting Up Tests and Sharing Test Context
- Demo - Sharing Context with the Constructor and Dispose Approach
- Demo - Sharing Context with the Class Fixture Approach
- Demo - Sharing Context with the Collection Fixture Approach
- Integrating Test Context with the ASP.NET Core Dependency Injection System
- Demo - Integrating Test Context with the ASP.NET Core Dependency Injection System
- Demo - Categorizing and Running Subsets of Tests
- Demo - Skipping Tests
- Demo - Adding Additional Test Output
- Summary
- Coming Up
- Introducing Theories and Data-driven Tests
- Demo - Testing a Theory with Inline Data
- Demo - Testing a Theory with Member Data
- Demo - Testing a Theory with Class Data
- Demo - Testing a Theory with Strongly-typed Test Data
- Getting Data from an External Source
- Demo - Getting Data from an External Source
- Summary
- Coming Up
- Investigating Test Isolation Approaches
- Unit Testing with Entity Framework Core
- Demo - Using SQLite In-memory Mode for Unit Testing
- Unit Testing with HttpClient
- Demo - Unit Testing with HttpClient
- Introducing Moq
- Demo - Creating and Using a Mock Object
- Demo - Configuring Mock Object Return Values
- Demo - Mocking an Interface
- Demo - Mocking Async Code
- Which Test Isolation Approach Should You Use?
- Summary
- Coming Up
- Code Coverage and Deciding What to Unit Test
- Introduction to Testing API Controllers
- Demo - Verifying ActionResult Types when Testing
- Demo - Verifying Model Types when Testing
- Demo - Verifying Model Content when Testing
- Demo - Combining Controller Action Asserts in One Unit Test and Testing Mapping Code
- Demo - Dealing with AutoMapper Dependencies
- Demo - Testing Validation and ModelState
- Testing with HttpContext
- Demo - Testing with HttpContext.Features
- Demo - Testing with HttpContext.User
- Demo - Testing with HttpClient Calls
- Summary
- Coming Up
- Unit Testing Middleware
- Demo - Unit Testing Middleware
- Unit Testing ASP.NET Core Filters
- Demo - Unit Testing ASP.NET Core Filters
- Unit Testing Service Registrations
- Demo - Unit Testing Service Registrations
- Summary
- Coming Up
- Demo - Running Tests with the CLI
- Test Runners Versus Test Frameworks
- Running Tests in Parallel
- Demo - Parallelism in Test Frameworks
- Demo - Parallelism in Test Runners
- Running Tests against Multiple Target Frameworks
- Demo - Running Tests Against Multiple Target Frameworks
- Integrating Unit Tests in Your CI/CD Pipeline
- Demo - Integrating Unit Tests in Your CI/CD Pipeline
- Summary
Comments
Post a Comment