Possible Duplicate:
How to mock a method call that takes a dynamic object
I have a method with dynamic argument:
public void SampleMethod(dynamic arg)
{
Console.WriteLine(arg.dynamicProperty);
}
Also I have a Moq mock for the class that contains this method. I need to verify that SampleMethod was called so I tried the following code
_dynClassMock.Verify(x => x.SampleMethod(It.IsAny<dynamic>()), Times.Once);
but it doesn't work. I've the following compile time error:
An expression tree may not contain a dynamic operation
Is there any workaround for this issue?