Lesson 43. Capstone 8

 

Phew—this is the last capstone exercise in this book! You’ll be performing unit testing here, and applying some of the techniques and tools presented in this unit to the Bank Accounts system you’ve been working on throughout the book.

43.1. Defining the problem

In this capstone, you’ll add a set of tests to the business logic domain of your application, using various test libraries that you’ve seen in this unit, from simple unit testing with xUnit, to DSL-based testing with Unquote, before finally writing a couple of property-based tests. You’ll test a couple of tiers as well. In this example, you won’t be writing any Canopy-based tests, but you’ll test a couple of internal layers within the application: the Web API tier and the internal Bank API, as illustrated in figure 43.1.

Figure 43.1. The API layers selected for unit tests

43.1.1. Solution overview

The solution you’ll be working with is what you finished up with at the end of the preceding capstone—a web-enabled version of your Bank API; you’ll find it in the lesson-43 folder. The main difference is that I’ve added a new test project to the solution. Once again, to save you from working with the hassles of NuGet binding redirects, I’ve done all the hard work for you. But so you know what’s been done

43.2. Writing API tests

43.3. Testing the Web API tier

43.4. Using property-based tests

Summary