typemoq
typemoq copied to clipboard
Bug: Verify behaving strangely (maybe?)
I'm trying to mock a function, and then verify it gets called. I'm using the below code:
// arrange
const safeEvalMock:
IMock<(string, any) => any> =
Mock.ofInstance(() => It.isAny());
const action = new Action(
It.isAnyObject(undefined),
safeEvalMock.object);
action.precondition = It.isAnyString();
action.goto = It.isAnyString();
// act
action.execute(It.isAny());
// assert
safeEvalMock.verify((x) =>
x(It.isAnyString(), It.isAny()), Times.once());
The exception I'm getting sounds like it failed to call the function... but then it shows under performed invocation, that it actually did call the function, even thouh invocation is displayed as 0 times.
MockException - invocation count verification failed (expected invocation of Function(It.isAnyString(),It.isAny()) exactly 1 times, invoked 0 times
Configured setups:
Function(It.isAnyString(),It.isAny())
Performed invocations:
Function(It.isAnyString(),It.isAny())
Did i misunderstand something, or is this a bug?
I have the same problem. Function is called once but the verification fails.
Same issue here :(