Does Moq mocking library for .NET 3.5 work with mono?
I'm trying to use Moq on a Mono / .NET 3.5 Project using MonoDevelop for MacOS X
I've tried the sample C# code:
var mock = new Mock<IFoo>();
mock.Setup((foo => foo.DoSomething("ping"))).Returns(true);
With IFoo beeing:
public interface IFoo
{
bool DoSomething(string a);
}
But I keep getting the following compiler errors on the mock.Setup line:
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' canno开发者_StackOverflowt convert `anonymous method' expression to type `System.Linq.Expressions.Expression<System.Action<Test.IFoo>>' (CS1503) (Test)
Am I doing something wrong or it´s just that Mono is not yet ready for Moq?
Like said in Preet Sangha's comment:
Add a reference to System.Core
精彩评论