Writing an OpenWeather client library
We have used the OpenWeather service in this book frequently, so I will give you a quick reminder – OpenWeather provides a set of RESTful APIs to bring you the weather and the forecast.
To consume the service from a C# application, it is good to have a library that will translate RESTful API calls to C# and shield the developer from the little details of HTTP. We call this sort of library a RESTful client library or sometimes a software development kit (SDK).
We will build an SDK for this service using TDD (of course!) and, while doing so, we will encounter more advanced mocking requirements.
The One Call API
OpenWeather has an API called One Call that will get you today’s weather information and the forecast for the next few days. The best way to illustrate how this works is by using an example that gets the weather and the forecast for Greenwich, London.
First, issue a RESTful GET
request. You can use your browser...