Thank you for the detailed explanation.
I was able to reproduce the issue on my side.
Unfortunately, there is no such functionality in JustMock at this point. However, the idea sounds great, so I have added it to our Ideas and Feedback portal. To vote for its faster implementation check this
Nevertheless, I also managed to find a workaround for this. Let`s assume we have the following:
myMock = Mock.Create<MyClass>(Behavior.CallOriginal);
Mock.Arrange(() => myMock.DoSmt()).DoNothing();
Mock.Assert(() => myMock.DoSmt(), Occurs.Once());
This will fail as the DoSmt() has actually been called two times (I believe you are experiencing similar issue).
However, to avoid this, I wrote the test like this:
Mock.Arrange(() => myMock.DoSmt()).DoNothing().OccursOnce();
This test passes. So, the workaround is to use occurrence expectations in the arrange.
I hope this helps.
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums
, or our JustTrace