Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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)));
        }