Created
December 15, 2018 18:36
-
-
Save alexjamesbrown/c15d2123a2f77dacf7fcb87581423c25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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