I'm trying to mock out a repository method with the signature:
Task<Model> FindByIdAsync<TProperty>(Guid id, Expression<Func<Model, TProperty>> include);
(The include
expression is used to include a dependent object on the queried object)
I don't care what the property expression is so I'm trying to use It.IsAny<something>
but I can't find the right format for the something
I've got as far as:
mockRepo.Setup(p => p.FindByIdAsync<object>( mockCall.Id, It.IsAny<Expression<Func<Call, object>>>() )).ReturnsAsync(mockObj);
but that doesn't match my code which looks like:
var m = await _modelRepo.FindByIdAsync( someId, m => m.SomePropertyToInclude );
What is the correct way to mock out this method?