Try using either of these:
mockModel.Setup(m => m.Items).Returns(listItem);
mockModel.SetupGet(m => m.Items).Returns(listItem);
The method SetupProperty
is used when you want to track its value, see moq wiki. Although I am not enterily sure why SetupProperty
fails, as its intention is to be able to assing and retrieve the property value, it seems likely to be caused by the private get.
To be clear, let's assume your property has a public set. In that case when using Setup
or SetupGet
, doing something like mockModel.Object.Items = new List<ItemList>();
would have no effect and you would still see the list with a single item. However with SetupProperty
the same statement would have changed the value returned by the property.
Basically SetupProperty
allows to get AND SET the value of a property and that's why I think it cannot be used with a private set.