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.

5
  • 2
    Write enough tests to be confident that your code are working. If for this you need to write tests for every type - do it. If you feel confident with only tests for integer - that's good too ;) Commented May 24, 2019 at 6:33
  • 1
    Possible duplicate of Where is the line between unit testing application logic and distrusting language constructs? Commented May 24, 2019 at 7:25
  • 1
    In addition to testing it with one or more integral types, you should also test it with your own struct NonIntegralType : IEquatable<NonIntegralType>, IComparable<NonIntegralType> to ensure that it handles a non-integral type that matches the generic constraints correctly. Commented May 24, 2019 at 9:40
  • There are infinitely many types acceptable to that Add Commented May 24, 2019 at 15:09
  • @ThomasFlinkow Can we see the implementation of the method or is it a trivial example signature? Commented May 25, 2019 at 19:19