Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public void Create_Person_Calls_PersonRepositoryAdd()
var person = new Person { BusinessEntityID = 3};
var mockpersonRepository = new Mock<IPersonRepository>();
mockpersonRepository.Setup(x => x.Add(person)); //no return as it's a void method
mockpersonRepository.Verify(x => x.Add(person), Times.Once()); //Assert that the Add method was called once
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.