This book defines a UNIT as the smallest testable piece of an application. I’m still struggling to understand what that means.
For instance, if I’m developing a client that exchanges messages with a server, is the client unto itself the UNIT? Or is the part that transmits the egress messages a UNIT within the client and the message receiver dealing with the ingress messages another UNIT? What about the connection state machine? and so on? Where are the boundaries?
So far in my development I’ve been treating each class as UNIT and mocking and/or stubbing any interactions it has with any other class (in trying to abide by the SRP - is a responsibility equivalent to a behaviour?), regardless of whether those collaborating classes are part of the client or not. I’m starting to question whether this is the right approach…
What do others think? Any advise would be appreciated.