> > > If additional context is required it fails to meet the definition of > > a unit test and is instead an integration test, and the function being > > tested may require rethinking. > > Depends what you define as a unit test. I'd say the unit was BigFraction > or Fraction. An integration test is something that must be tested with > coherant components working together to provide functionality. You are > not doing that. >
Well, I totally agree with both of you that this is the superior approach for architecture and maintainability. Maybe I should think about adding a bit more setup to my own unit tests. I think it is not quite right to say that Fraction is the unit. I think unit tests test atomic behaviors in the code that ideally can only fail one way; those are the units. But this is just semantics. So if you are both in agreement I can change to a +1.