Skip to content

Instantly share code, notes, and snippets.

@alexjamesbrown
Created December 15, 2018 18:39
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/2d62b8adf5fcf85d0cfd34bbbf7dca5c to your computer and use it in GitHub Desktop.
Save alexjamesbrown/2d62b8adf5fcf85d0cfd34bbbf7dca5c to your computer and use it in GitHub Desktop.
//Arrange
var mockCustomerService = new Mock();
var customerController = new CustomerController(mockCustomerService.Object);
Customer customerServiceSaveArg = null;
mockCustomerService
.Setup(x => x.Save(It.IsAny()))
.Returns(1)
.Callback(c => customerServiceSaveArg = c);
//Act
var result = customerController.Post("Alex", "Brown");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment