Skip to content

Instantly share code, notes, and snippets.

@alexjamesbrown
Created December 15, 2018 18:36
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 alexjamesbrown/c15d2123a2f77dacf7fcb87581423c25 to your computer and use it in GitHub Desktop.
Save alexjamesbrown/c15d2123a2f77dacf7fcb87581423c25 to your computer and use it in GitHub Desktop.
//Arrange
var mockCustomerService = new Mock();
var customerController = new CustomerController(mock.Object);
mockCustomerService.Setup(x=> x.Save(It.IsAny())
.Returns(1);
//Act
customerController.Post("Alex", "Brown");
//Assert
mockCustomerService
.Verify(x => x.Save(
It.Is(
c =>
c.FirstName == "Alex" &&
c.LastName == "Brown"
)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment