Skip to content

Instantly share code, notes, and snippets.

@ffMathy
Created August 22, 2018 20:30
Show Gist options
  • Save ffMathy/465e986a12c06e0914e9c9baf57db6f5 to your computer and use it in GitHub Desktop.
Save ffMathy/465e986a12c06e0914e9c9baf57db6f5 to your computer and use it in GitHub Desktop.
const mockedCalculator = TypeMoq.Mock.ofType(RealCalculator);
const calculator = mockedCalculator.object;
calculator.add(1, 2);
mockedCalculator.verify(x => x.add(1, 2), TypeMoq.Times.once()); //called exactly once
mockedCalculator.verify(x => x.add(1, 2), TypeMoq.Times.atLeastOnce()); //called at least once
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment