2 ms·
At least in my language of choice (C#), the general wisdom is that feeling a need to unit test against an object's internal state is a code smell. It suggests
by bunderbunder 14y ago
At least in my language of choice (C#), the general wisdom is that feeling a need to unit test against an object's internal state is a code smell. It suggests that your class is violating the single responsibility principle and needs to be separated into multiple smaller ones.
Writing tests against implementation details makes the code less maintainable, since it means that you won't be able to change those implementation details without rewriting (or worse yet, just commenting out) unit tests.