public void TestProcess() { var testMessage = new MailMessage(); var context = new Mock<IEmailContext>().Object; _mockMessageBuilder.Setup(b=> b.BuildMessage(context, _mockRepository.Object)).Returns(testMessage); var processor = new EmailProcessor(_mockMessageBuilder.Object, _mockMessageSender.Object, _mockRepository.Object); processor.Process(context); _mockMessageBuilder.Verify(b => b.BuildMessage(context, _mockRepository.Object), Times.Once()); _mockMessageSender.Verify(s => s.Send(testMessage), Times.Once()); }
public void TestProcess_NullMessage() { var context = new Mock<IEmailContext>().Object; var processor = new EmailProcessor(_mockMessageBuilder.Object, _mockMessageSender.Object, _mockRepository.Object); processor.Process(context); _mockMessageSender.Verify(s => s.Send(It.IsAny<MailMessage>()), Times.Never()); }