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

OutOfMemoryException thrown when mock is called many times - Option for verification opt-out needed #227

Closed
thefellow3j opened this issue Dec 15, 2015 · 5 comments

Comments

@thefellow3j
Copy link

I have a situation in which a mock needs to be called over 1,000,000 times, with parameters. Because call capturing is automatic, Moq captures each call and its data and stores it in memory.

In this situation, I have no need for the verification of mock methods being called. Can you implement a constructor parameter or MockRepository option that can explicitly enable or disable mock verification, subsequently avoiding capturing calls and storing their data in memory?

@janslav
Copy link

janslav commented Aug 9, 2016

Seconding this, it's a real issue in bigger tests.

@stakx
Copy link
Contributor

stakx commented Jul 6, 2017

Until (if) such an opt-out is implemented, have you tried (as a workaround only, of course) resetting the mock using mock.ResetCalls() e.g. after every few thousand calls?

@stakx
Copy link
Contributor

stakx commented Nov 24, 2017

Now that we have Mock.Switches and MockRepository.Switches (feature / compatibility switches), this probably wouldn't be too difficult to implement.

@thefellow3j, @janslav - since this issue has been at sleep for a while... is automatic call capture by default still a problem for you, or can we close this?

@stakx
Copy link
Contributor

stakx commented Nov 29, 2017

If you're still interested in this, please post back. Until then, I am closing this issue due to inactivity.

@AqlaSolutions
Copy link

I need 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

4 participants