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*

2
  • 2
    You should use same "best practices" for the tests as you use for the application code. Usually having bool as argument for the method - is sign that method can be split in two. In this case you can introduce two test methods with proper name TestForPrimaryNumbers and TestForOtherNumbers which will be more easily to follow Commented Mar 3, 2018 at 9:49
  • 1
    @Fabio: what you wrote is fine, but it distracts somewhat from my core point, I tried not to change the original code more than necessary. So for the sake of demonstration, lets imagine the real test data is read from some file. Commented Mar 3, 2018 at 9:51