public FamSendGridEmailServiceTests()
        {
            var defaultTemplate = new EmailTemplate
            {
                To      = "*****@*****.**",
                Body    = "Body",
                Subject = DefaultSubject,
            };

            fakeEmailTemplateRepository = A.Fake <IEmailTemplateRepository>();
            A.CallTo(() => fakeEmailTemplateRepository.GetByTemplateName(A <string> .Ignored)).Returns(defaultTemplate);

            fakeMergeEmailContentService = A.Fake <IMergeEmailContent <ContactUsRequest> >();
            fakeSendGridClient           = A.Fake <ISendGridClient>();
            var defaultResponse = new Response(HttpStatusCode.Accepted, A.Fake <HttpContent>(), null);

            A.CallTo(() => fakeSendGridClient.SendEmailAsync(A <SendGridMessage> .Ignored, A <CancellationToken> .Ignored)).Returns(defaultResponse);

            fakeSimulateEmailResponsesService = A.Fake <ISimulateEmailResponses>();
            fakeAuditRepository   = A.Fake <IAuditNoncitizenEmailRepository <ContactUsRequest> >();
            fakeHttpClientService = A.Fake <IHttpClientService <INoncitizenEmailService <ContactUsRequest> > >();

            var areaRoutingApiResponse = new AreaRoutingApiResponse {
                EmailAddress = EmailAddressFromAreaRouting
            };
            var httpResponseMessage = new HttpResponseMessage {
                Content = new StringContent(JsonConvert.SerializeObject(areaRoutingApiResponse), Encoding.Default, "application/json")
            };

            A.CallTo(() => fakeHttpClientService.GetAsync(A <string> .Ignored, A <FaultToleranceType> .Ignored)).Returns(httpResponseMessage);
            fakeMapper = A.Fake <IMapper>();
            fakeConfigurationProvider = A.Fake <IConfigurationProvider>();
            fakeApplicationLogger     = A.Fake <IApplicationLogger>();
        }
 public SendGridEmailService(
     IEmailTemplateRepository emailTemplateRepository,
     IMergeEmailContent <ContactUsRequest> mergeEmailContentService,
     IAuditNoncitizenEmailRepository <ContactUsRequest> auditRepository,
     ISimulateEmailResponses simulateEmailResponsesService,
     ISendGridClient sendGridClient,
     IMapper mapper)
 {
     this.emailTemplateRepository       = emailTemplateRepository;
     this.mergeEmailContentService      = mergeEmailContentService;
     this.auditRepository               = auditRepository;
     this.simulateEmailResponsesService = simulateEmailResponsesService;
     this.sendGridClient = sendGridClient;
     this.mapper         = mapper;
 }
예제 #3
0
 public FamSendGridEmailService(
     IEmailTemplateRepository emailTemplateRepository,
     IMergeEmailContent <ContactUsRequest> mergeEmailContentService,
     IAuditNoncitizenEmailRepository <ContactUsRequest> auditRepository,
     ISimulateEmailResponses simulateEmailResponsesService,
     ISendGridClient sendGridClient,
     IMapper mapper,
     IHttpClientService <INoncitizenEmailService <ContactUsRequest> > httpClientService,
     IConfigurationProvider configuration,
     IApplicationLogger applicationLogger) : base(emailTemplateRepository, mergeEmailContentService, auditRepository, simulateEmailResponsesService, sendGridClient, mapper)
 {
     this.emailTemplateRepository = emailTemplateRepository;
     this.httpClientService       = httpClientService;
     this.configuration           = configuration;
     this.applicationLogger       = applicationLogger;
 }
예제 #4
0
 public SendGridEmailServiceTests()
 {
     fakeEmailTemplateRepository       = A.Fake <IEmailTemplateRepository>(ops => ops.Strict());
     fakeMergeEmailContentService      = A.Fake <IMergeEmailContent <ContactUsRequest> >(ops => ops.Strict());
     fakeSendGridClient                = A.Fake <ISendGridClient>(ops => ops.Strict());
     fakeConfiguration                 = A.Fake <Core.IConfigurationProvider>(ops => ops.Strict());
     fakeSimulateEmailResponsesService = A.Fake <ISimulateEmailResponses>(ops => ops.Strict());
     fakeAuditRepository               = A.Fake <IAuditNoncitizenEmailRepository <ContactUsRequest> >(ops => ops.Strict());
     fakeMapper        = A.Fake <IMapper>(ops => ops.Strict());
     goodEmailTemplate = new EmailTemplate
     {
         Body         = nameof(EmailTemplate.Body),
         BodyNoHtml   = nameof(EmailTemplate.BodyNoHtml),
         To           = nameof(EmailTemplate.To),
         TemplateName = nameof(EmailTemplate.TemplateName),
         Subject      = nameof(EmailTemplate.Subject),
         From         = nameof(EmailTemplate.From)
     };
 }