Moq with lambda expressions?
问题 I am trying to test an application service using Moq 4.0.10827 (on NuGet) and need to query a repository: public class MyService { Repository<MyObject> _Repo; public MyObject Get (string SomeConstraint) { return _Repo .GetTheFirstOneOrReturnNull (M => M.Constraint.Equals ( SomeContraint, StringComparison.InvariantCultureIgnoreCase )); // GetTheFirstOneOrReturnNull takes a Func<MyObject, bool> } } How do I replicate the lambda expression with Moq? I keep getting the "Unsupported expression"