I'm trying to mock an action that console writes "hi" when it gets invoked but I'm getting the following error:
Unable to cast object of type 'System.Linq.Expressions.InstanceMethodCallExpressionN' to type 'System.Linq.Expressions.InvocationExpression'.
Here is what I got and maybe I am not doing this correctly:
var actionMock = Mock.Of<Action>();
var getActionMock = Mock.Get(actionMock);
getActionMock.Setup(c => c.Invoke()).Callback(() => {
Console.Write("hi");
});
Any help or suggestion would be great!