public async Task Setup() { _ukprn = 228987165; _emailAddresses = new List <string> { "*****@*****.**", "*****@*****.**" }; _templateId = Guid.NewGuid().ToString(); _tokens = new Dictionary <string, string>(); _tokens.Add("key1", "value1"); _tokens.Add("key2", "value2"); _accountOrchestrator = new Mock <IAccountOrchestrator>(); _mediator = new Mock <IMediator>(); _configuration = new ProviderApprenticeshipsServiceConfiguration { CommitmentNotification = new ProviderNotificationConfiguration() }; _accountOrchestrator .Setup(x => x.GetAccountUsers(_ukprn)) .ReturnsAsync(_emailAddresses.Select(x => new User { EmailAddress = x, ReceiveNotifications = false })); _request = new ProviderEmailRequest { TemplateId = _templateId, Tokens = _tokens }; _sut = new EmailOrchestrator(_accountOrchestrator.Object, _mediator.Object, Mock.Of <IProviderCommitmentsLogger>()); await _sut.SendEmailToAllProviderRecipients(_ukprn, _request); }
private void ConfigureHttpClient(ProviderApprenticeshipsServiceConfiguration config) { For <ProviderApprenticeshipsService.Infrastructure.Data.IHttpClientWrapper>() .Use <ProviderApprenticeshipsService.Infrastructure.Data.HttpClientWrapper>() .Ctor <HttpClient>() .Is(c => GetHttpClient(c)); }
public void Arrange() { ProviderApprenticeshipsServiceConfiguration = new ProviderApprenticeshipsServiceConfiguration() { ContentApplicationId = "das-providerapprenticeshipsservice-web", DefaultCacheExpirationInMinutes = 1 }; ContentBanner = "<p>find out how you can pause your apprenticeships<p>"; MockCacheStorageService = new Mock <ICacheStorageService>(); _contentType = "banner"; _clientId = "das-providerapprenticeshipsservice-web"; _logger = new Mock <ILog>(); _contentBannerService = new Mock <IClientContentService>(); _contentBannerService .Setup(cbs => cbs.Get(_contentType, _clientId)) .ReturnsAsync(ContentBanner); _request = new GetClientContentRequest { ContentType = "banner" }; _handler = new GetClientContentRequestHandler(_logger.Object, _contentBannerService.Object, MockCacheStorageService.Object, ProviderApprenticeshipsServiceConfiguration); }
public BulkUploadValidator(ProviderApprenticeshipsServiceConfiguration config, IUlnValidator ulnValidator, IAcademicYearDateProvider academicYear) { _validationText = new BulkUploadApprenticeshipValidationText(academicYear); _viewModelValidator = new ApprenticeshipUploadModelValidator(_validationText, new CurrentDateTime(), ulnValidator, academicYear); _config = config; }
public IdamsEmailServiceWrapper( ILog logger, ProviderApprenticeshipsServiceConfiguration configuration, IHttpClientWrapper httpClientWrapper) { _logger = logger; _configuration = configuration.CommitmentNotification; _httpClientWrapper = httpClientWrapper; }
public void SetUp() { var config = new ProviderApprenticeshipsServiceConfiguration { CheckForContractAgreements = true }; _agreementRepository = new Mock <IAgreementStatusQueryRepository>(); _handler = new GetProviderAgreementQueryHandler(_agreementRepository.Object, config); }
public GetClientContentRequestHandler( ILog logger, IClientContentService service, ICacheStorageService cacheStorageService, ProviderApprenticeshipsServiceConfiguration providerApprenticeshipsServiceConfiguration) { _logger = logger; _service = service; _cacheStorageService = cacheStorageService; _providerApprenticeshipsServiceConfiguration = providerApprenticeshipsServiceConfiguration; }
public SubmitCommitmentCommandHandler(IProviderCommitmentsApi commitmentsApi, IValidator <SubmitCommitmentCommand> validator, IMediator mediator, ProviderApprenticeshipsServiceConfiguration configuration, IHashingService hashingService) { _commitmentsApi = commitmentsApi; _validator = validator; _mediator = mediator; _configuration = configuration; _hashingService = hashingService; }
private HttpClient CreateClient(IContext context, ProviderApprenticeshipsServiceConfiguration providerApprenticeshipsServiceConfiguration) { var config = providerApprenticeshipsServiceConfiguration.ContentApi; HttpClient httpClient = new HttpClientBuilder() .WithBearerAuthorisationHeader(new AzureActiveDirectoryBearerTokenGenerator(config)) .WithHandler(new RequestIdMessageRequestHandler()) .WithHandler(new SessionIdMessageRequestHandler()) .WithDefaultHeaders() .Build(); return(httpClient); }
public void SetUp() { var config = new ProviderApprenticeshipsServiceConfiguration { CommitmentNotification = new ProviderNotificationConfiguration { IdamsListUsersUrl = "https://url.to/users/ukprn={0}", ClientToken = "AbbA-Rules-4.Ever" }, }; _mockHttpClientWrapper = new Mock <IHttpClientWrapper>(); _sut = new IdamsEmailServiceWrapper(Mock.Of <ILog>(), config, _mockHttpClientWrapper.Object); }
public CommitmentOrchestrator(IMediator mediator, IHashingService hashingService, IProviderCommitmentsLogger logger, ApprenticeshipViewModelUniqueUlnValidator uniqueUlnValidator, ProviderApprenticeshipsServiceConfiguration configuration, IApprenticeshipCoreValidator apprenticeshipCoreValidator, IApprenticeshipMapper apprenticeshipMapper, IEncodingService encodingService, IReservationsService reservationsService) : base(mediator, hashingService, logger) { _uniqueUlnValidator = uniqueUlnValidator; _configuration = configuration; _apprenticeshipCoreValidator = apprenticeshipCoreValidator; _apprenticeshipMapper = apprenticeshipMapper; _encodingService = encodingService; _reservationsService = reservationsService; }
public void Setup() { _validCommand = new SubmitCommitmentCommand() { ProviderId = 111L, HashedCommitmentId = "ABC123", CommitmentId = 123L, Message = "Test Message", CreateTask = true, LastAction = LastAction.Approve, UserDisplayName = "Test User", UserEmailAddress = "*****@*****.**", UserId = "user123" }; _mockCommitmentsApi = new Mock <IProviderCommitmentsApi>(); _mockCommitmentsApi.Setup(x => x.GetProviderCommitment(_validCommand.ProviderId, _validCommand.CommitmentId)) .ReturnsAsync(new CommitmentView { ProviderId = _validCommand.ProviderId, AgreementStatus = AgreementStatus.NotAgreed, Reference = "ABC123", EmployerLastUpdateInfo = new LastUpdateInfo { EmailAddress = "EmployerTestEmail" }, ProviderName = "ProviderName", EmployerAccountId = 100 }); _mockHashingService = new Mock <IHashingService>(); _mockHashingService.Setup(x => x.HashValue(It.IsAny <long>())).Returns <long>((p) => "HS" + p.ToString()); var configuration = new ProviderApprenticeshipsServiceConfiguration { EnableEmailNotifications = true }; _mockMediator = new Mock <IMediator>(); _handler = new SubmitCommitmentCommandHandler(_mockCommitmentsApi.Object, new SubmitCommitmentCommandValidator(), _mockMediator.Object, configuration, _mockHashingService.Object); }
private void ConfigureHashingService(ProviderApprenticeshipsServiceConfiguration config) { For <IHashingService>().Use(x => new HashingService.HashingService(config.AllowedHashstringCharacters, config.Hashstring)); For <IPublicHashingService>().Use(x => new PublicHashingService(config.PublicAllowedHashstringCharacters, config.PublicHashstring)); For <IAccountLegalEntityPublicHashingService>().Use(x => new PublicHashingService(config.PublicAllowedAccountLegalEntityHashstringCharacters, config.PublicAllowedAccountLegalEntityHashstringSalt)); }
public ProviderRepository(ProviderApprenticeshipsServiceConfiguration config, ILog logger) : base( config.DatabaseConnectionString, logger) { }
public GetProviderAgreementQueryHandler(IAgreementStatusQueryRepository agreementStatusQueryRepository, ProviderApprenticeshipsServiceConfiguration configuration) { _agreementStatusQueryRepository = agreementStatusQueryRepository; _configuration = configuration; }
public CacheStorageService(IDistributedCache distributedCache, ProviderApprenticeshipsServiceConfiguration config) { _distributedCache = distributedCache; _config = config; }
public UserSettingsRepository(ProviderApprenticeshipsServiceConfiguration config, ILog logger) : base(config.DatabaseConnectionString, logger) { _logger = logger; }