Beispiel #1
0
        public async Task FirstRoundInviteEmailsSentCorrectly()
        {
            //Assign
            _notificationsApiClientMock  = new Mock <INotificationsApi>();
            _employerSurveyInviteEmailer = new EmployerSurveyInviteEmailer(
                _dbEmployerFeedbackRepository,
                _notificationsApiClientMock.Object,
                _options,
                _surveyLoggerMock.Object);

            //Act
            await _employerSurveyInviteEmailer.SendEmailsAsync();

            //Assert
            _notificationsApiClientMock.Verify(x => x.SendEmail(It.IsAny <Email>()), Times.Exactly(2));
        }
Beispiel #2
0
            public UserWithSingleEntry()
            {
                _options = Options.Create(new EmailSettings {
                    FeedbackSiteBaseUrl = "https://test-site.com/", BatchSize = 10
                });

                var emailDetails = new List <EmployerSurveyInvite>
                {
                    new EmployerSurveyInvite {
                        UserRef = new Guid("7f11a6b0-a25b-45a5-bdfc-4424dfba85e8"), EmailAddress = "*****@*****.**"
                    }
                };

                _mockStore.Setup(x => x.GetEmployerUsersToBeSentInvite()).ReturnsAsync(emailDetails);

                _emailer = new EmployerSurveyInviteEmailer(_mockStore.Object, _mockEmailService.Object, _options, _mockLogger.Object);
            }
Beispiel #3
0
        public async Task ThirdRoundInviteEmailsSentCorrectly()
        {
            await _dbConnection.ExecuteAsync($@" 
                UPDATE EmployerSurveyHistory
                SET SentDate = @newSentDate
                WHERE EmailType = 1 AND UniqueSurveyCode IN (SELECT UniqueSurveyCode FROM EmployerSurveyCodes WHERE FeedbackId IN (SELECT FeedbackId FROM EmployerFeedback WHERE UserRef in @userRefs))",
                                             new { newSentDate = DateTime.UtcNow - TimeSpan.FromDays(91), userRefs = new[] { _user1Guid, _user2Guid } });

            _employerSurveyInviteEmailer = new EmployerSurveyInviteEmailer(_dbEmployerFeedbackRepository,
                                                                           _notificationsApiClientMock.Object, _options, _surveyLoggerMock.Object);

            await RunThroughRefreshFunctions();

            //Act
            await _employerSurveyInviteEmailer.SendEmailsAsync();

            //Assert
            _notificationsApiClientMock.Verify(x => x.SendEmail(It.IsAny <Email>()), Times.Exactly(2));
        }
 public SurveyInviteEmailer(EmployerSurveyInviteEmailer inviteEmailer)
 {
     _inviteEmailer = inviteEmailer;
 }