Reputation: 7709
I created this gist to describe what's happening:
https://gist.github.com/IanRandall/5417410
briefly: The .Verify assertion is failing in the first implementation of .Get() method on the repository, as Moq is not noticing that the mapper is being called.
Anyone else seen this? Am I missing something?
Cheers :)
Upvotes: 1
Views: 126
Reputation: 4166
The classic IEnumerable concept error.
You're returning an iterator with the linq query. The iterator won't actually call the function until you iterate over it.
If you did this (for example), you should see it work, as it forces the iteration:
return results.Select(entity => _mapper.Transform(entity)).ToList();
Upvotes: 5