`mock.Protected()` does not properly support indexers
MoqProtected can be improved. MoqProtectedAs does not suffer these issues. I think that despite there being an alternative this should be addressed.
SetUpSet ignores the value parameter and uses ItExpr.IsAny() This is contrary to the xml docs.
VerifySet also ignores the value parameter. This behaviour is best shown with Moq's own tests
[Fact]
public void VerifySetAllowsProtectedInternalPropertySet()
{
var mock = new Mock<FooBase>();
mock.Object.ProtectedInternalValue = "foo";
mock.Protected().VerifySet<string>("ProtectedInternalValue", Times.Once(), "bar");
} [Fact]
public void DoesNotThrowIfVerifySetPropertyTimesReached()
{
var mock = new Mock<FooBase>();
mock.Object.SetProtectedValue("foo");
mock.Object.SetProtectedValue("foo");
mock.Protected().VerifySet<string>("ProtectedValue", Times.Exactly(2), ItExpr.IsAny<int>());
}Indexers are not properly supported.
These are not so important https://github.com/moq/moq4/blob/a6fde8b6d79a7437bf642d115785b97f40779b6a/src/Moq/Protected/ProtectedMock.cs#L92 https://github.com/moq/moq4/blob/a6fde8b6d79a7437bf642d115785b97f40779b6a/src/Moq/Protected/ProtectedMock.cs#L186 https://github.com/moq/moq4/blob/a6fde8b6d79a7437bf642d115785b97f40779b6a/src/Moq/Protected/ProtectedMock.cs#L267
This ( and SetupSet ) should be supported.
should receive args to support indexers
It already does.
SetupGet and VerifyGet should also allow for indexers.
Source: devlooped/moq
