Mid ASP.NET Core

Testing Web API endpoints (unit / integration)?

  • Unit testing: Mock services/repositories using Moq or FakeItEasy.
  • Integration testing: Use WebApplicationFactory<T> + TestServer

+ HttpClient.

var client = _factory.CreateClient();

var response = await client.GetAsync("/api/products");

More from ASP.NET Core Tutorial

All questions for this course