HomeChallengesRepsProblemsLeaderboardTake a challenge

The whole pipeline, in memory

Routing, model binding, filters and serialisation. Test the endpoint, not the controller method.

Intermediate20 min on the clock5 graded checks · 100 pointsTesting an ASP.NET Core APIPro
Graded by reading your code against the checklist below.

What you build

  • Bring the app up with WebApplicationFactory<Program>
  • Share it across the class with IClassFixture so it starts once
  • Call GET /api/products with a client the factory gives you
  • Assert on the exact status code
  • Deserialise the body and assert on what is in it

Done means

The app under test, a real request, and assertions on both the status and the payload.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. The app is booted with WebApplicationFactory+25Testing the pipeline, not the method
  2. The request goes through the factory’s client+15Testing the pipeline, not the method
  3. The exact status code is asserted+20Testing the pipeline, not the method
  4. The response body is checked, not just the status+25Testing the pipeline, not the method
  5. The test is async and never blocks+15async and await

What it teaches

The rest of Testing an ASP.NET Core API