I have the below code where my Mock interface has a Recorder property which is a class.

I then try to set a property on that class but I get a Expression is not a method invocation error. Could you help?

The error is at runtime when it goes to try an set the enum property. It throws an ArgumentException with the below 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)

Thanks

//Works
var mock = new Moq.Mock<IEngine>(); 
//Works
mock.Setup(x => x.Recorder).Returns(new Moq.Mock<Recorder>().Object);  
//Fails on the next line assigning a property value!!!
mock.Setup(x => x.Recorder.RunState).Returns(Recorder.eRunStates.Play);  

UPDATE - I have found that RunState is not a property but a field/member which is a enum

Edit
Report