Exposing private state to enable unit testing

added by DotNetKicks
11/2/2017 12:26:28 PM

1 Kicks, 302 Views

Last time, we talked about making private methods public in order to enable unit testing. It's not the only way people expose implementation details to the outside world for unit testing purposes, though. Today, we'll look at a similar anti-pattern: exposing private state. Let's look at the following example: View the code on Gist.