florinn/typemoq

Interface method names missing in MockException

Closed this issue · 1 comments

Not sure if I'm missing something but I it would be nice if the error message would contain the method names for easy debugging.

interface IFoo {
  doFoo: () => void;
  doBar: (a: number, b: string) => boolean;
}

const mock: IMock<IFoo> = Mock.ofType<IFoo>();

mock.setup((fakeFoo: IFoo) => fakeFoo.doFoo()).verifiable();
mock.setup((fakeFoo: IFoo) => fakeFoo.doBar(2, 'bar')).returns(() => false).verifiable();

const fakeFoo: IFoo = mock.object;

fakeFoo.doFoo();
fakeFoo.doBar(2, '');

mock.verifyAll();
MockException - invocation count verification failed (expected invocation of Function(It.isValue(2),It.isValue("bar")) exactly 1 times, invoked 0 times
 Configured setups:
 Function(), once
 Function(It.isValue(2),It.isValue("bar")), once

 Performed invocations:
 Function()
 Function(2,"")
➜  node -v
v9.10.1
➜   npm ls typescript typemoq
├── typemoq@2.1.0 
└── typescript@2.8.1 

Closing this as I've migrated to a different library.