public async Task ReturnsExpectedResponseCodeIfEmailSent() { var emailViewModel = BuildEmailViewModel(); var orchestrator = new NotificationOrchestrator(_mediator.Object); var response = await orchestrator.SendEmail(emailViewModel); Assert.That(response.Code, Is.EqualTo(NotificationOrchestratorCodes.Post.Success)); }
public async Task ReturnsExpectedResponseCodeOnValidationfailure() { var emailViewModel = BuildEmailViewModel(); emailViewModel.UserId = string.Empty; var orchestrator = new NotificationOrchestrator(_mediator.Object); var response = await orchestrator.SendEmail(emailViewModel); Assert.That(response.Code, Is.EqualTo(NotificationOrchestratorCodes.Post.ValidationFailure)); }
public async Task CallsExpectedMediatorMethod() { var emailViewModel = BuildEmailViewModel(); var orchestrator = new NotificationOrchestrator(_mediator.Object); await orchestrator.SendEmail(emailViewModel); _mediator.Verify(med => med.SendAsync(It.Is <SendEmailCommand>(x => x.UserId == emailViewModel.UserId && x.MessageType == emailViewModel.MessageType && x.RecipientsAddress == emailViewModel.RecipientsAddress && x.ReplyToAddress == emailViewModel.ReplyToAddress && x.ForceFormat == emailViewModel.ForceFormat && x.Data == emailViewModel.Data))); }