You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stubbed properties are excluded from verification, regardless of whether they were stubbed with SetupAllProperties or SetupProperty. (From a user's perspective, it likely wouldn't be very intuitive if there were a difference between these two, other than that the former method is the batch version of the latter.)
That is, both tests should pass.
Actual outcome:
The second test (stubbing with SetupProperty) fails with this MockException:
Mock<IX:1>:
This mock failed verification due to the following:
IX m => m.P:
This setup was not matched.
IX m => m.P = It.IsAny<object>():
This setup was not matched.
at Moq.Mock.VerifyAll()
at ...
The text was updated successfully, but these errors were encountered:
Having thought about this some more, it is perhaps a good thing that SetupProperty and SetupAllProperties behave differently: you'd only intentionally setup a property if you actually expected it to be set and queried. Otherwise, you'd be more specific and setup just the getter or the setter, or have no setup at all.
Closing this as "by design" until someone actually runs into problems because of it.
Steps to reproduce:
Expected outcome:
Stubbed properties are excluded from verification, regardless of whether they were stubbed with
SetupAllProperties
orSetupProperty
. (From a user's perspective, it likely wouldn't be very intuitive if there were a difference between these two, other than that the former method is the batch version of the latter.)That is, both tests should pass.
Actual outcome:
The second test (stubbing with
SetupProperty
) fails with thisMockException
:The text was updated successfully, but these errors were encountered: