Working on my Tic Tac Toe game today I realised that I needed an over arching class object that was at a higher level than displaying game options, setting up game and starting the game.
I came to this realisation as I had no way to run my game. I introduced the AppGame class that had this responsibility,
Once I began testing the AppGame class I had to create a fake test double within a test double, which I wasn’t sure if this was the best approach but was the simplest at the time.
I faked the FakeConsoleGameSetup which was dependent on a Game object, so I faked the Game object too to avoid being in an infinite loop, because the real Game object starts the game and loops until there’s a winner.
My other option could’ve been to use the real ConsoleGameSetup object and fake the Game object or perhaps there’s a way to only use real object, I would be interested in knowing how.