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

Get Invocation Count / Verify with Or #219

Open
ConorMurphy21 opened this issue Dec 2, 2020 · 2 comments
Open

Get Invocation Count / Verify with Or #219

ConorMurphy21 opened this issue Dec 2, 2020 · 2 comments

Comments

@ConorMurphy21
Copy link

I'm trying to verify that one of the overloaded method signatures gets called. I don't care which one gets called. Is there a way I could do this with fakeit? ie Verify(Method(foo, bar) || Method(Foo, bar)).Twice(). Or if that doesn't exist is there a way to get the invocation count of a method so I can just add them together?

@FranckRJ
Copy link
Collaborator

FranckRJ commented Nov 9, 2022

There is no built-in way for that as far as I know, you can manually do it by mocking these functions with a Do and passing a lambda that increment a counter but I guess you were asking for a built-in solution.

@malcolmdavey
Copy link
Contributor

malcolmdavey commented Nov 9, 2022

Obviously the Do can be used, but an alternative could be adding a function that returns the number of invocations, then you could manually Assert etc. Not sure if there is a nicer syntactically sugary way to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants