Exemplo n.º 1
0
        public async Task When_SendPendingEmailsIsCalled_AndThereAreTwoPendingEmails_Then_EmailSenderServiceCallsGetPendingEmailsTwice()
        {
            // Given
            _emailsRepositoryMock
            .Setup(mock => mock.GetPendingEmails())
            .ReturnsAsync(new ActionResponse <IEnumerable <EmailDto> >(new List <EmailDto> {
                _emailDtoStub, _emailDtoStub
            }, SuccessResponseMessage));
            var controller = new MailingController(_emailsRepositoryMock.Object, _emailSenderServiceMock.Object);

            // When
            await controller.SendPendingEmails();

            // Then
            _emailSenderServiceMock.Verify(mock => mock.Send(
                                               It.IsAny <string>(), It.IsAny <IEnumerable <string> >(), It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(2));
        }