Example #1
0
        public void ShouldContainCandidateFirstNameSubstitution(int noOfDrafts)
        {
            var expiringDrafts = new ExpiringApprenticeshipApplicationDraftsBuilder().WithSpecialCharacterExpiringDrafts(noOfDrafts).Build();
            var emailRequest   = new DailyDigestEmailRequestBuilder().WithExpiringDrafts(expiringDrafts).Build();
            List <SendGridMessageSubstitution> sendGridMessageSubstitutions;
            var sendGridMessage = GetSendGridMessage(out sendGridMessageSubstitutions);

            var emailMessageFormatter = new EmailDailyDigestMessageFormatterBuilder().Build();

            emailMessageFormatter.PopulateMessage(emailRequest, sendGridMessage.Object);

            sendGridMessageSubstitutions.Any(s => s.ReplacementTag == CandidateFirstNameTag).Should().BeTrue();
        }
Example #2
0
        public void GivenMultipleExpiringDraftsSpecialCharacters(int noOfDrafts)
        {
            var expiringDrafts = new ExpiringApprenticeshipApplicationDraftsBuilder().WithSpecialCharacterExpiringDrafts(noOfDrafts).Build();
            var emailRequest   = new DailyDigestEmailRequestBuilder().WithExpiringDrafts(expiringDrafts).Build();
            List <SendGridMessageSubstitution> sendGridMessageSubstitutions;
            var sendGridMessage = GetSendGridMessage(out sendGridMessageSubstitutions);

            var emailMessageFormatter = new EmailDailyDigestMessageFormatterBuilder().Build();

            emailMessageFormatter.PopulateMessage(emailRequest, sendGridMessage.Object);

            sendGridMessageSubstitutions.Count(s => s.ReplacementTag == ExpiringDraftsTag).Should().Be(1);
            var expiringDraftsSubstitution = sendGridMessageSubstitutions.Single(s => s.ReplacementTag == ExpiringDraftsTag);

            expiringDraftsSubstitution.SubstitutionValues.Single().Should().Be(GetExpectedInfoSubstitution(expiringDrafts));
        }
Example #3
0
        public void GivenMultipleExpiringApplicationStatusAlerts()
        {
            var alerts = new ApplicationStatusAlertsBuilder().WithApplicationStatusAlerts(2, ApplicationStatuses.Successful).Build()
                         .Concat(new ApplicationStatusAlertsBuilder().WithApplicationStatusAlerts(3, ApplicationStatuses.Unsuccessful).Build()).ToList();
            var emailRequest = new DailyDigestEmailRequestBuilder().WithApplicationStatusAlerts(alerts).Build();
            List <SendGridMessageSubstitution> sendGridMessageSubstitutions;
            var sendGridMessage = GetSendGridMessage(out sendGridMessageSubstitutions);

            var emailMessageFormatter = new EmailDailyDigestMessageFormatterBuilder().Build();

            emailMessageFormatter.PopulateMessage(emailRequest, sendGridMessage.Object);

            var applicationStatusAlertTagSubstitution = sendGridMessageSubstitutions.Single(s => s.ReplacementTag == ApplicationStatusAlertTag);

            applicationStatusAlertTagSubstitution.SubstitutionValues.Count.Should().Be(1);
            applicationStatusAlertTagSubstitution.SubstitutionValues.Single().Should().Be(GetExpectedInfoSubstitution(alerts));
        }