[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