Testing Web API Services

This chapter covers testing your ASP.NET Web API service. It will take a comprehensive look at both isolated unit testing of the individual Web API components and at broadly scoped end-to-end integration tests.

You will learn how to do the following:

  • Test controllers, message handlers, filters, and formatters (Recipes 11-1, 11-2, 11-3, and 11-4)
  • Take advantage of the testability benefits of IHttpActionResult (Recipe 11-5)
  • Test Web API routes (Recipe 11-6)
  • Run Web API in memory to perform complex integration tests (Recipes 11-7 and 11-8)

All the code samples used in this chapter rely on xUnit as the testing ...

Get ASP.NET Web API 2 Recipes: A Problem Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.