private EuGatewayService CreateGatewayService( TemporaryExposureKeyRepository keysRepository, ISignatureService signatureService, IMapper autoMapper, IGatewayHttpClient gateWayHttpClient, IKeyFilter keyFilter, IGatewayWebContextReader webContextReader, IEFGSKeyStoreService storeService, ILogger <EuGatewayService> logger, EuGatewayConfig config) { var encodingService = new EncodingService(); var epochConverter = new EpochConverter(); var gatewaySyncStateSettingsDao = new GatewaySyncStateSettingsDao(new SettingRepository(_dbContext)); var settingsService = new SettingsService(gatewaySyncStateSettingsDao); return(new EuGatewayService( keysRepository, signatureService, encodingService, keyFilter, webContextReader, autoMapper, logger, config, settingsService, epochConverter, gateWayHttpClient, storeService)); }
private EuGatewayService CreateGatewayServiceAndDependencies(IGatewayHttpClient httpClient) { var translationsRepositoryMock = new Mock <IGenericRepository <Translation> >(MockBehavior.Strict); IOriginSpecificSettings originConfig = new AppSettingsConfig() { OriginCountryCode = _originCountry.Code.ToUpper() }; var countryRepository = new CountryRepository(_dbContext, translationsRepositoryMock.Object, originConfig); var keysRepository = new TemporaryExposureKeyRepository(_dbContext, countryRepository, _logger.Object); var signatureServiceMock = new Mock <ISignatureService>(MockBehavior.Strict); signatureServiceMock.Setup(sigService => sigService.Sign(It.IsAny <TemporaryExposureKeyGatewayBatchProtoDto>(), Domain.SortOrder.ASC)) .Returns(new byte[] { 1, 2, 3, 4, 5, 6, 7 }); var webContextReaderMock = new Mock <IGatewayWebContextReader>(MockBehavior.Strict); var loggerMock = new Mock <ILogger <EuGatewayService> >(MockBehavior.Loose); var keyFilterMock = new Mock <IKeyFilter>(MockBehavior.Strict); var storeService = new Mock <IEFGSKeyStoreService>(MockBehavior.Strict); var autoMapper = CreateAutoMapperWithDependencies(countryRepository); return(CreateGatewayService(keysRepository, signatureServiceMock.Object, autoMapper, httpClient, keyFilterMock.Object, webContextReaderMock.Object, storeService.Object, loggerMock.Object, _config )); }
public EuGatewayService(ITemporaryExposureKeyRepository tempKeyRepository, ISignatureService signatureService, IEncodingService encodingService, IKeyFilter keyFilter, IGatewayWebContextReader gatewayWebContextReader, IMapper mapper, ILogger <EuGatewayService> logger, EuGatewayConfig euGatewayConfig, ISettingsService settingsService, IEpochConverter epochConverter, IGatewayHttpClient gatewayHttpClient, IEFGSKeyStoreService storeService ) { _signatureService = signatureService; _tempKeyRepository = tempKeyRepository; _encodingService = encodingService; _keyFilter = keyFilter; _webContextReader = gatewayWebContextReader; _mapper = mapper; _logger = logger; _euGatewayConfig = euGatewayConfig; _settingsService = settingsService; _epochConverter = epochConverter; _gatewayHttpClient = gatewayHttpClient; _storeService = storeService; }
private EuGatewayService CreateGatewayServiceAndDependencies(IGatewayHttpClient httpClient) { _keysRepository = new TemporaryExposureKeyRepository(_dbContext, _countryRepository, _temporaryExposureKeyRepositoryLogger.Object); var signatureServiceMock = new Mock <ISignatureService>(MockBehavior.Strict); var webContextReader = new GatewayWebContextReader(_autoMapper, _loggerGatewayWebContextReader.Object); var epochConverter = new EpochConverter(); var keyValidator = new KeyValidator(epochConverter); var exposureKeyMapper = new ExposureKeyMapper(_epochConverter); var keyFilterLoggerMock = new Mock <ILogger <KeyFilter> >(MockBehavior.Loose); var keyFilter = new KeyFilter(_autoMapper, keyValidator, exposureKeyMapper, keyFilterLoggerMock.Object, _keysRepository); var storeServiceLoggerMock = new Mock <ILogger <EFGSKeyStoreService> >(); var riskCalculator = new RiskCalculator(); var dsosDecoder = new DaysSinceOnsetOfSymptomsDecoder(); var addTemporaryExposureKeyService = new Mock <IAddTemporaryExposureKeyService>(MockBehavior.Strict); addTemporaryExposureKeyService .Setup(x => x.FilterDuplicateKeysAsync(It.IsAny <List <TemporaryExposureKey> >())) .ReturnsAsync((List <TemporaryExposureKey> argument) => { return(argument); }); var storeService = new EFGSKeyStoreService(keyFilter, _keysRepository, storeServiceLoggerMock.Object, riskCalculator, epochConverter, dsosDecoder, addTemporaryExposureKeyService.Object); var gatewayServiceLoggerMock = new Mock <ILogger <EuGatewayService> >(MockBehavior.Loose); return(CreateGatewayService( _keysRepository, signatureServiceMock.Object, _autoMapper, httpClient, keyFilter, webContextReader, storeService, gatewayServiceLoggerMock.Object, epochConverter, _config )); }
public PaymentsController(IGatewayHttpClient httpClient, IOptions <GatewayOptions> gatewayOptions) { _httpClient = Guard.IsNotNull(httpClient, nameof(httpClient)); _gatewayOptions = Guard.IsNotNull(gatewayOptions, nameof(gatewayOptions)).Value; }