Skip to content

Instantly share code, notes, and snippets.

@efleming969
Last active June 13, 2018 11:03
Show Gist options
  • Save efleming969/bb60ef51617b79c827669cc2ae6f7758 to your computer and use it in GitHub Desktop.
Save efleming969/bb60ef51617b79c827669cc2ae6f7758 to your computer and use it in GitHub Desktop.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
[TestClass]
public class MockingTests
{
[TestMethod]
public void should_send_an_email()
{
var mockEmailService = new Mock<IEmailService>();
GreetingBuilder3 sut = new GreetingBuilder3(mockEmailService.Object);
sut.Build("[email protected]", "joe");
mockEmailService.Verify(es => es.Send("[email protected]", "hello, joe!"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment