我正在尝试使用MonoDevelop for MacOS X在Mono / .NET 3.5项目上使用Moq
我尝试过C#代码示例:
var mock = new Mock<IFoo>();
mock.Setup((foo => foo.DoSomething("ping"))).Returns(true);
使用IFoo beeing:
public interface IFoo
{
bool DoSomething(string a);
}
但是我一直在mock.Setup行上得到以下编译器错误:
Error CS1660: Cannot convert `lambda expression' to non-delegate type `System.Linq.Expressions.Expression<System.Action<Test.IFoo>>' (CS1660) (Test)
Error CS1502: The best overloaded method match for `Moq.Mock<Test.IFoo>.Setup(System.Linq.Expressions.Expression<System.Action<Test.IFoo>>)' has some invalid arguments (CS1502) (Test)
Error CS1503: Argument `#1' cannot convert `anonymous method' expression to type `System.Linq.Expressions.Expression<System.Action<Test.IFoo>>' (CS1503) (Test)
我做错了什么,或者只是Mono尚未为Moq做好准备?