If you write your tests first, then you'll be forced to write code that is easy to test at the same
time, code that is easy to test is immune to bugs, and it tends to be more polished.
So the first step of test driven development is to identify meaningful test cases from the requirements
when the cart adds an item to its collection.
We need to check if the cart contains the item that was just added.
So test if the cart contains the item.
After it's added.
We also got to make sure the cart doesn't add an item that it already contains.
Test if the cart.
Scheps duplicate item.
And now there's another requirement about removing an item, so we're going to test if the item.
Gets removed after being sold.
And the code to throw an exception, if the user tries to remove from an empty cart, so test for an
illegal state exception.
We're trying to remove from an empty cart.
And for this requirement, we got a test of the subtotal as calculated correctly.
Test if the tax is calculated correctly.
Test for the total.
And we're also going to test for an illegal state acceptant for trying to check out an empty cart.
If every test passes, we can rest assured that our code doesn't have any bugs.
All right.
That is all for part one.
We've identified every meaningful test case and now we can start unit testing.
See you soon.