The final code is in the branch workshop-end: https://github.com/firenzedev/tdd-workshop/tree/workshop-end
- Add a small test.
- Run all the tests and fail.
- Make a small change.
- Run tests and succeed.
- Refactor to remove duplication.
We want to create a multi-currency report, like this:
| Supplier | Quantity | Price | Total |
|---|---|---|---|
| CodeCorp | 1000 | 25 USD | 25000 USD |
| BugBusters | 400 | 150 CHF | 60000 CHF |
| Total | 65000 USD |
We also need to specify exchange rates:
| From | To | Rate |
|---|---|---|
| CHF | USD | 1.5 |
Thinking about what we want to achieve, I wrote some tasks to guide us during development:
- generate report
- 1000 x 25USD + 400 x 150CHF = 65000USD when the rate is 2:1
-
$5 + 10 CHF = $10if rate is 2:1 -
$5 * 2 = $10 - [ ]