typemoq
typemoq copied to clipboard
TypeMoq stops recording mocked invocations after 3 times
Background
My target class is constructed with a UnitOfWorkFactory instance. This instance encapsulates a reusable piece of code for creating transactions in TypeORM. This is done within the trans method. The trans method takes an async lambda and executes it within a transactional context.
Issue
When the trans method is mocked and a callback is setup to manually execute the async lambda parameter, any other executions of mocked services inside of the async lambdas are not counted after the 3rd invocation.
JSFiddle link here https://jsfiddle.net/peterwbeck/t271b630/