Declined
Last Updated: 14 Oct 2015 08:26 by Stefan
Kaloyan
Created on: 28 May 2013 10:56
Type: Feature Request
1
A way to reset occurrences of a certain method
I have a unit test where I assert that a certain action will call a method on a mock dependency object by using Mock.Assert().  I want to ensure that the action I take calls the method on the mock object exactly once.  The problem is that the setup of the unit test creates a scenario where the method of the mock object will also be called, so when I assert that the call to the mock object happened just once it fails because it has actually been called more than once.

Is there a way to "reset" the call tracking of methods on mock objects?  I basically want to tell JustMock that at a certain point, whatever calls have happened to my mock objects should be discarded and the call counter should basically start at 0 again.
1 comment
Stefan
Posted on: 14 Oct 2015 08:26
Mock.GetTimesCalled() can be used to fulfill your requirements.