Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
.Net Core Mock Test with Moq4
public void When_Member_Access_to_Profile_By_Using_Moq() {
var mock = new Mock<IAuthorize>();
mock.Setup(auth => auth.CheckAuthorize(It.IsAny<string>(), It.IsAny<string>())).Returns(true).Verifiable();
Member member = new Member(mock.Object);
mock.Verify(auth => auth.CheckAuthorize(It.IsAny<string>(), It.IsAny<string>()), Times.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.