I am mocking a repository that should have 1 entity in it for the test scenario. The repository has to return this entity based on a known id and return nothing when other ids are passed in.
I have tried doing something like this:
_myRepository.Expect(item => item.Find(knownId)).Return(knownEntity);
_myRepository.Expect(item => item.Find(Arg<Guid>.Is.Anything)).Return(null);
It seems however the second line is overriding the first and the repository always returns null. I don't want to mock all the different possible IDs asked (they could go up to hundreds) when the test scenario is only concerned with the value of one Id.
I understand that I can change the second line to be the negative of the first. However this would become more and more difficult (as well as ugly) if the repository has to return more than 1 entity for a test scenario.