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*
- 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?Maloooo– Maloooo2019-07-22 12:34:14 +00:00Commented 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.herby– herby2019-07-22 13:08:09 +00:00Commented Jul 22, 2019 at 13:08
- Actually, I added one more things, see the edit.herby– herby2019-07-22 16:04:26 +00:00Commented Jul 22, 2019 at 16:04
Add a comment |
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you