I am getting this error when I try to set a mock to have PropertyBehavior()
:
System.InvalidOperationException: System.InvalidOperationEx
I ran into this issue when I was trying to call an internal
property (getter only) on an object in C#. In this case, adding .PropertyBehavior()
did not help.
My solution was to extract the logic out of the property and into an internal method which I then injected dependencies into this method (as parameters).