Chapter 14. The Sniper Wins the Auction
In which we add another feature to our Sniper and let it win an auction. We introduce the concept of state to the Sniper which we test by listening to its callbacks. We find that even this early, one of our refactorings has paid off.
First, a Failing Test
We have a Sniper that can respond to price changes by bidding more, but it doesn’t yet know when it’s successful. Our next feature on the to-do list is to win an auction. This involves an extra state transition, as you can see in Figure 14.1:
To represent this, we add an end-to-end test based on sniperMakesAHigherBidButLoses() ...
Get Growing Object-Oriented Software, Guided by Tests now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.