Lets say I am in the process of converting my code from using an ADO client for all my database calls to an ORM. Currently I'm looking at the Interactor class and how it uses the repositories. I want my tests to tell me:
Interactor.UpdateMessage(MessageRequest) calls methods:
- UserValidation.IsAuthenticated() returns boolean
- MessageRepository.GetMessage() returns MessageEntity
- Validators.ValidateMessage(messageEntity) returns ValidatedMessage
- MessageReposirory.UpdateMessage(ValidatedMesssage)
From this test information, I know that if I'm making a new class to replace MessageRepository it will have GetMessage() called first. If the test fails because my new implementation returns a null from the GetMessage() method, my test will tell me exactly that. However if I only tested the contract of Interactor.UpdateMessage(), it would fail and not tell me why. The only way I would know how it failed is through debugging the test.