Assertion failed for the following call:
'FakeItEasy.Examples.IPersonRepository.Save()'
Expected to find it exactly never but found it #1 times among the calls:
1. 'FakeItEasy.Examples.IPersonRepository.Save(
personToSave: FakeItEasy.Examples.Person)'

While this is a good exception message it doesn't say a whole lot about the person object that was used in the call to save. You could ofcourse in this particular instance override the ToString-method of person to fix this, but a lot of times you don’t have control over the types you use (for example the framework types). Now, fortunately, in the latest release of FakeItEasy, there is a dead simple way for you to provide your own formatter for printed argument values.

All you have to do is in your testproject define a class that inherits the FakeItEasy.ArgumentValueFormatter<T>-class where T is the type of class you wish to provide custom formatting for.

Now, let’s run the same test again and see what the exception message looks like: (I’ve split the message over several lines in this post so that the message will not be truncated by the blog).

Assertion failed for the following call:
'FakeItEasy.Examples.IPersonRepository.Save()'
Expected to find it exactly never but found it #1 times among the calls:
1. 'FakeItEasy.Examples.IPersonRepository.Save(
personToSave: Person named Patrik Hägne,
date of birth 1977-04-05 (12227,874689919 days old).)'