Skip to content

Instantly share code, notes, and snippets.

@ThomasArdal
Last active December 11, 2015 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasArdal/4562879 to your computer and use it in GitHub Desktop.
Save ThomasArdal/4562879 to your computer and use it in GitHub Desktop.
A test using the Verify-method of Moq.
[Test]
public void SomeTest() {
// Arrange
var mock = new Mock<IDependency>();
var sut = new ServiceUnderTest(mock.Object);
// Act
sut.DoIt();
// Assert
mock.Verify(x => x.AMethodCall(
It.Is<string>(s => s.Equals("Hello")),
It.Is<string>(s => s.Equals("World"))));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment