does it make sense to mark a function/method as `i...
# announcements
h
does it make sense to mark a function/method as
internal
so that it can be unit tested? or is there a better way to do it without marking it as internal or public?
s
I feel like this is going to turn into a debate on test scoping
what I’ve heard is that only public methods should get tested, but I couldn’t make a recommendation either way myself
but as such, it would mean that the question of changing the visibility of a private method is itself incorrect
m
Exactly as Shawn said. Unit testing does not mean testing every function/method in isolation. Only the public. If you test everything specifically, it removes your safety net for refactoring.
h
thanks. I'll refrain from making my method internal
v
it’s worth adding that if that method feels rather complex/as something that should be really tested. It may be an indication that splitting it off (and relevant data) into a separate smaller class may be a good idea
m
since it's supposed to be a "private" method, then nothing can trigger it expects the public ones, so prober testing the public methods which trigger it should be enough.