Linq to Mocks set null as result

32 views
Skip to first unread message

Jozef Krchňavý

unread,
Feb 13, 2014, 7:07:46 AM2/13/14
to moq...@googlegroups.com
Hello,
is it possible to use Linq to Mock to set return value null?

// This doesn't work:
var mock = Mock.Of<IClass>(c => c.GetValue(5) == null);

// neither this
var mock = Mock.Of<IClass>(c => c.GetValue(5) == (string)null);

// only setup way:

var mock = new Mock<IClass>();

mock.Setup(c=>c.GetValue(5)).Returns((string)null);



Thank you!
Jozef



Reply all
Reply to author
Forward
0 new messages