Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Thanks for the answer. I agree with you, I was probably biased by the fact that in game dev you usually have an Update method that does all the logic of the game. I'm passing the Player to the Game using the constructor so that I can use a Fake or similar in other tests and I'm also passing an EnemyFactory to the Game that creates the Enemies, so I just edited my question to be more clear. So you are suggesting to move the logic into a Step() method, and that one would be public? Or pass into Game some external logic that has the Step method? and test that one? Commented Jul 22, 2019 at 12:34
  • Maybe "having a public interface to run the game" and "doing the game logic" are two responsibilities. If you will have GameLogic class which can have more structured (and public, that is, testable) interface (Start(), HandleFoo(), HandleBar(), Finish(), ... making things up) and Game which would just a facade that calls proper things on GameLogic in its Run method, you may have these two reponsibilities divided, and then testing naturally is easier for both parts. Commented Jul 22, 2019 at 13:08
  • Actually, I added one more things, see the edit. Commented Jul 22, 2019 at 16:04