I have the following test:
[Test]
public void Save_WhenExceptionIsThrown_ThenExceptionIsLogged()
{
A.CallTo(() => this.personRepository.Save(A<PrsPerson>._)).Throws(new Exception("Expected Exception"));
var personen = this.GetPersonenCollectionWithSpecificAmount(2);
this.testee.Save(personen);
A.CallTo(() => this.applicationLogger.Error(A<string>._)).MustHaveHappened(Repeated.Exactly.Once);
}
This works like a charm, but what I want to assert additionally is, whether the logger was called with exactly the message of the thrown exception and not just any string.
Is it possible to capture the exception thrown and if so, how?