Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #41: False positive for FakeItEasy0003 when using argument constraint in CallToSet with indexer property #42

Conversation

zivarah
Copy link

@zivarah zivarah commented Jan 20, 2023

Fixes #41.

Usage of A.CallToSet(...) and Fake.CallsToSet(...) with an argument constraint will no longer throw FakeItEasy0003 warnings. As far as I am aware, these are only going to be valid when the property specification is an indexer, so those are the test cases I added.

Examples:

// C#
A.CallToSet(() => foo[A<string>._]).DoesNothing();
fake.CallsToSet(foo => foo[A<string>._]).DoesNothing();
// VB
A.CallToSet(Function() foo(A(Of Integer).Ignored)).DoesNothing()
fake.CallsToSet(Function(foo) foo(A(Of Integer).Ignored)).DoesNothing()

Please note that I am much less familiar with VB syntax in general, and have never used FakeItEasy with VB, so go easy on me if I messed that part up at all. I have no excuse if I messed up the C# part 😁.

Copy link
Member

@blairconrad blairconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, @zivarah. Thanks. I appreciate the bonus cleanup (method names, null checks) that you did while you were in the area.

@thomaslevesque
Copy link
Member

Excellent work, thanks @zivarah!

@thomaslevesque thomaslevesque merged commit ecab896 into FakeItEasy:master Jan 20, 2023
@blairconrad blairconrad mentioned this pull request Jan 20, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive for FakeItEasy0003 when using argument constraint in CallToSet with indexer property
3 participants