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*

11
  • 2
    +1 for for showing that I don't need any if/else branching. If first assert fails then it automatically jumps to next. Commented Mar 30, 2014 at 11:57
  • as for as "pedantic" is concerned, I have already faced so many problems, written brittle test cases, and all that could potentially go wrong with a test project. At the end I have even abandoned using the Unit Test project. The context here was that Unit Tests should be more readable and if they are readable and simple, it is likely that those unit tests will be used for a longer time. Commented Mar 30, 2014 at 12:21
  • @shankbond: that unit test is as simple as it can be without changing signatures. If you want it to be even simpler, change the API of your sut and remove the out parameters. Commented Mar 30, 2014 at 13:08
  • 2
    @shankbond the question is how your three values correlate... why does your method produce all three of them? because they are part of some higher-level entity? Then capturing them in an aggregate class seems a good idea. If not, why are they computed in the same method? Split the method up into three methods, each of which returns one of the values. Commented Mar 31, 2014 at 8:20
  • 1
    @salsolatragus how would you handle intDivide(int numerator, int denominator, out int quotient, out int remainder)? Wouldn't packaging up the quotient and remainder into a class be a bit excessive? And if you want both, calling two functions (when you've already got the result from a single operation) becomes unnecessarily expensive. Commented Mar 31, 2014 at 16:12