CHAPTER 11

image

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.