I'm using Rhino Mocks to unit test a service method that makes the following call:
var form = Repo.GetOne<Form>(f => f.Id == formId, "FormTemplate, Event");
The Repo.GetOne method signature is:
TEntity GetOne<TEntity>(
Expression<Func<TEntity, bool>> filter = null,
string includeProperties = null)
where TEntity : class, IEntity;
So far I have only managed to do this by ignoring the Function Expression argument:
_mockRepo.Stub(
r =>
r.GetOne<Form>(
Arg<Expression<Func<Form, bool>>>.Is.Anything,
Arg<string>.Is.Equal("FormTemplate, Event")))
.Return(form);
How do I stub the Repo.GetOne method in order to set the return value when the method is called with arguments f => f.Id == formId, "FormTemplate, Event"
?