Skip to content

Instantly share code, notes, and snippets.

@DavidArno
Created September 22, 2015 11:16
Show Gist options
  • Save DavidArno/77894aa795d175e76590 to your computer and use it in GitHub Desktop.
Save DavidArno/77894aa795d175e76590 to your computer and use it in GitHub Desktop.
Reply to blog.ploeh.dk-2015-09-21-public-types-hidden-in-plain-sight
<div class="comment">
<div class="comment-author">David Arno</div>
<div class="comment-content">
In your summary, you state "The main disadvantage of using the internal access modifier is that you can't easily unit test such a class".
Your entire post builds a complex, messy workaround to this through marking active methods as obsolete and having to wrap tests in "ignore warning"
pragmas. Yet the whole article misses the elephant in the room: internal classes are implementation details; they should not be unit tested directly.
Implementation details change, leading to brittle tests that need rewriting as those details change. Unit tests should test public APIs. If internal code
cannot be reached via a public API, then delete it as it has no purpose.
</div>
<div class="comment-date">2015-08-22 12:15 UTC</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment