With FakeItEasy, how to assert, that any of calls has happened?
The use case is I'm writing a class that works with a repository and as a result of a method, the class should remove some elements from the repository, either by calling DeleteAll, or by calling Delete for all of them.
For now, I've used a try-catch like this:
try // either
{
A.CallTo(() => module.CardRepo.Delete(A<CardData>.That.IsEqualTo(dummy.CardData[0]))).MustHaveHappened();
A.CallTo(() => module.CardRepo.Delete(A<CardData>.That.IsEqualTo(dummy.CardData[1]))).MustHaveHappened();
}
catch (ExpectationException) // or
{
A.CallTo(() => module.CardRepo.DeleteAll(A<IEnumerable<CardData>>.That.Contains(dummy.CardData[0]))).MustHaveHappened();
A.CallTo(() => module.CardRepo.DeleteAll(A<IEnumerable<CardData>>.That.Contains(dummy.CardData[1]))).MustHaveHappened();
}
but I don't like that and for more choices it would quickly become really ugly. Is there a better way? I couldn't find anything on FakeItEasy wiki.