Moq how to correctly mock read-only properties or set only properies
- by Chris Marisic
What is the correct way for dealing with interfaces the expose only read-only or set-only properties with Moq? Previously I've added the other accessor but this has bleed into my domain too far with random throw new NotImplementedException() statements throughout.
I just want to do something simple like
mock.VerifySet(view => view.SetOnlyValue, Times.Never());
But this is a compile error of The property 'SetOnlyValue' has no getter