Last active
May 7, 2016 07:24
-
-
Save aamiraftab/c724b94e86430f72cba1db21fd34c572 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
[Fact] | |
public void Get_Person_By_Id() | |
{ | |
var person = new Person { BusinessEntityID = 3}; | |
var mockpersonRepository = new Mock(); | |
mockpersonRepository.Setup(x => x.GetPersonById(3)) | |
.Returns(person); //return Person | |
mockpersonRepository.Object.GetPersonById(3).ShouldBe(person); //Assert expected value equal to actual value | |
mockpersonRepository.Verify(x => x.GetPersonById(person.BusinessEntityID), Times.Once()); //Assert that the Get method was called once | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment