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>();
        }
Пример #2
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;
 }