public void Init() { IServiceCollection services = new ServiceCollection(); services.AddAutoMapper(typeof(EuGatewayProtoToDtosMapper)); IServiceProvider serviceProvider = services.BuildServiceProvider(); var autoMapper = serviceProvider.GetService <IMapper>(); var loggerGatewayWebContextReader = new Mock <ILogger <GatewayWebContextReader> >(); WebContextReader = new GatewayWebContextReader(autoMapper, loggerGatewayWebContextReader.Object); WebContextMock = new WebContextMock(); }
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 void Init() { _webContextReader = new GatewayWebContextReader(); _webContextMock = new WebContextMock(); }