Skip to content

Instantly share code, notes, and snippets.

@StacyGay
Created April 11, 2021 20:03
Show Gist options
  • Save StacyGay/0d00ebe5e3bd8a208159aa6b7ae067f0 to your computer and use it in GitHub Desktop.
Save StacyGay/0d00ebe5e3bd8a208159aa6b7ae067f0 to your computer and use it in GitHub Desktop.
Trinity of test - Moq
[Fact]
public void Basic_Unit_Test()
{
var mockRepo = new Mock<IMyRepo>();
mockRepo.Setup(foo => foo.GetSomething(It.IsAny<int>())).Returns("Something");
var serviceUnderTest = new MyUpperService(mockRepo);
var result = serviceUnderTest.MakeUpper();
Assert.Equal("SOMETHING",result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment