© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
2 replies
Nemesis

❔ Moq VerifySet not working with indexed property

I am writing an Unit test to verify if the indexed property ([]) is being called for a class. For that I am doing:
Mock.Get(classObject).VerifySet(o => o[index] = value, Times.Once())
Mock.Get(classObject).VerifySet(o => o[index] = value, Times.Once())

But I get an error saying the expression is not a setter.
VerifyGet
VerifyGet
and
SetupSet
SetupSet
work fine with index
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ ✅ Moq problems with "MethodCall.cs"
C#CC# / help
3y ago
✅ adding SQLite [Indexed] to a C# class property
C#CC# / help
3y ago
learning moq framework
C#CC# / help
2y ago
❔ WinForms Topmost property not working as intended.
C#CC# / help
3y ago