Skip to main content

Exercise: The Foreign Exchange API

During the first day of the workshop we wrote unit tests for a Foreign Exchange API. Now its time to go back and fully cover it with Integration tests.

The test cases

Using the techniques we learned in this section, write the following integration tests:

  • GetQuote_ShouldReturnQuote_WhenCurrencyPairIsSupported
  • GetQuote_ShouldReturnBadRequest_WhenBaseAndQuoteCurrenciesAreTheSame
  • GetQuote_ShouldReturnNotFound_WhenCurrencyIsNotSupported
  • GetQuote_ShouldReturnBadRequest_WhenAmountUsedIsZeroOrLess

There is a basic structure already set up for you in ForeignExchange.Api.Tests.Integration and all the necessary Nuget packages are already added.

tip

Feel free to raise your hand and call me over if you need any help