Unit testing code paths
- by Michael
When unit testing using expectations, you define a set of method calls and corresponding results for those calls. These define the path through the method that you want to test.
I have read that unit tests should not duplicate the code. But when you define these expectations, isn't that duplicating the code, or at least the process? How do you know when you're duplicating functionality under test?