Implementing the WebApis with TDD
To build the WebApi project, we are going to look at each requirement from Chapter 8, Designing an Appointment Booking App, and provide the implementation that satisfies it using the TDD style.
The requirements are all stated in terms of Website
and its functionality, and they do not dictate how to build our APIs. Website
will have to call WebApis
for any business logic as it has no access to the DB and does UI-related business logic only.
In this section, we will go through working in TDD mode, taking into consideration our persistence provider, the repositories.
Implementing the first story
The first story in our requirement is very easy. The website is going to display all the available services that we have. Since the website will request this data from WebApi
through a RESTful API call, the domain layer will have a service that will return this list. Let’s dig further if the website is to display this: