public void Arrange() { _configuration = new EmployerCommitmentsServiceConfiguration { CommitmentNotification = new CommitmentNotificationConfiguration { SendEmail = true } }; _providerEmailService = new Mock <IProviderEmailService>(); _providerEmailService.Setup(x => x.SendEmailToAllProviderRecipients(It.IsAny <long>(), It.IsAny <string>(), It.IsAny <EmailMessage>())) .Callback <long, string, EmailMessage>((l, s, m) => _sentEmailMessage = m) .Returns(Task.CompletedTask); _providerEmailNotificationService = new ProviderEmailNotificationService(_providerEmailService.Object, Mock.Of <ILog>(), Mock.Of <IHashingService>(), _configuration); _exampleCommitmentView = new CommitmentView { ProviderId = 1, ProviderLastUpdateInfo = new LastUpdateInfo { EmailAddress = "LastUpdateEmail" }, LegalEntityName = "Legal Entity Name", Reference = "Cohort Reference" }; _act = async() => await _providerEmailNotificationService.SendProviderTransferRejectedCommitmentEditNotification( _exampleCommitmentView); }
public void Arrange() { _configuration = new EmployerCommitmentsServiceConfiguration { CommitmentNotification = new CommitmentNotificationConfiguration { SendEmail = true } }; _providerEmailService = new Mock <IProviderEmailService>(); _providerEmailService.Setup(x => x.SendEmailToAllProviderRecipients(It.IsAny <long>(), It.IsAny <string>(), It.IsAny <EmailMessage>())) .Callback <long, string, EmailMessage>((l, s, m) => _sentEmailMessage = m) .Returns(Task.CompletedTask); _hashingService = new Mock <IHashingService>(); _hashingService.Setup(x => x.HashValue(It.IsAny <long>())).Returns("HASH"); _providerEmailNotificationService = new ProviderEmailNotificationService(_providerEmailService.Object, Mock.Of <ILog>(), _hashingService.Object, _configuration); var payload = new Apprenticeship { ProviderId = 123L, LegalEntityName = "Legal Entity Name", ULN = "1234567890", FirstName = "John", LastName = "Smith", PaymentStatus = PaymentStatus.Withdrawn, StopDate = new DateTime(2018, 05, 01) }; //Keep a copy of the payload to assert against, to guard against handler modifications _exampleApprenticeship = JsonConvert.DeserializeObject <Apprenticeship>(JsonConvert.SerializeObject(payload)); _exampleNewStopDate = new DateTime(2018, 04, 01); _act = async() => await _providerEmailNotificationService.SendProviderApprenticeshipStopEditNotification( payload, _exampleNewStopDate); }
public void Arrange() { _configuration = new EmployerCommitmentsServiceConfiguration { CommitmentNotification = new CommitmentNotificationConfiguration { SendEmail = true } }; _providerEmailService = new Mock <IProviderEmailService>(); _providerEmailService.Setup(x => x.SendEmailToAllProviderRecipients(It.IsAny <long>(), It.IsAny <string>(), It.IsAny <EmailMessage>())) .Callback <long, string, EmailMessage>((l, s, m) => _sentEmailMessage = m) .Returns(Task.CompletedTask); _providerEmailNotificationService = new ProviderEmailNotificationService(_providerEmailService.Object, Mock.Of <ILog>(), Mock.Of <IHashingService>(), _configuration); _exampleCommitmentView = new CommitmentView { Reference = CohortReference, ProviderId = ProviderId, ProviderLastUpdateInfo = new LastUpdateInfo { EmailAddress = ProviderLastUpdatedByEmail } }; _transferApprovalStatus = TransferApprovalStatus.Approved; _tokens = new Dictionary <string, string> { { "cohort_reference", CohortReference }, { "ukprn", ProviderId.ToString() } }; _act = async() => await _providerEmailNotificationService.SendSenderApprovedOrRejectedCommitmentNotification(_exampleCommitmentView, _transferApprovalStatus); }