If I do this:
var repository = new Mock<IRepository<Banner>>(); repository.Setup(x => x.Where(banner => banner.Is.AvailableForFrontend())).Returns(list);
Where is the method in my repository that accepts Func<T, ISpecification<T> . AvailableForFrontend returns an implementation of ISpecification, and the list is an IEnumberable of a generic repository type.
It compiles fine, but I get the following error while running my tests.
---- System.NotSupportedException : Expression banner => Convert((banner.Is.AvailableForFrontend() & banner.Is.SmallMediaBanner())) is not supported.
If I use my other Where in the repository overload, which accepts ISpecification directly, the problem does not occur.
So my question is about my newbie's mockups / monk: Is it possible to drown out a method call using the lamdba parameter as a parameter? Or should I go about it differently?
Luhmann
source share