I have the code below where my Mock interface has a Recorder property, which is a class.
Then I try to set a property in this class, but I get an error Expression is not a method invocation. Could you help me?
A runtime error when it tries to set the enum property. It throws an ArgumentException using the following stack trace:
at Moq.ExpressionExtensions.ToMethodCall(LambdaExpression expression)
at Moq.Mock.<>c__DisplayClass1c`2.<Setup>b__1b()
at Moq.PexProtector.Invoke[T](Func`1 function)
at Moq.Mock.Setup[T,TResult](Mock mock, Expression`1 expression, Func`1 condition)
at Moq.Mock`1.Setup[TResult](Expression`1 expression)
thank
var mock = new Moq.Mock<IEngine>();
mock.Setup(x => x.Recorder).Returns(new Moq.Mock<Recorder>().Object);
mock.Setup(x => x.Recorder.RunState).Returns(Recorder.eRunStates.Play);
UPDATE - I found that RunState is not a property, but a field / member, which is an enumeration
source
share