Exemplo n.º 1
0
 public ExposureDetectionService
 (
     ILoggerService loggerService,
     IUserDataRepository userDataRepository,
     IExposureDataRepository exposureDataRepository,
     ILocalNotificationService localNotificationService,
     IExposureRiskCalculationConfigurationRepository exposureRiskCalculationConfigurationRepository,
     IExposureRiskCalculationService exposureRiskCalculationService,
     IExposureConfigurationRepository exposureConfigurationRepository,
     IEventLogService eventLogService,
     IDebugExposureDataCollectServer exposureDataCollectServer,
     IDateTimeUtility dateTimeUtility,
     IDeviceInfoUtility deviceInfoUtility
 )
 {
     _loggerService                  = loggerService;
     _userDataRepository             = userDataRepository;
     _exposureDataRepository         = exposureDataRepository;
     _localNotificationService       = localNotificationService;
     _exposureRiskCalculationService = exposureRiskCalculationService;
     _exposureRiskCalculationConfigurationRepository = exposureRiskCalculationConfigurationRepository;
     _exposureConfigurationRepository = exposureConfigurationRepository;
     _eventLogService           = eventLogService;
     _exposureDataCollectServer = exposureDataCollectServer;
     _dateTimeUtility           = dateTimeUtility;
     _deviceInfoUtility         = deviceInfoUtility;
 }
        public ExposureCheckPageViewModel(
            INavigationService navigationService,
            ILoggerService loggerService,
            IExposureDataRepository exposureDataRepository,
            IExposureRiskCalculationService exposureRiskCalculationService,
            ILocalPathService localPathService,
            IExposureDataExportService exposureDataExportService,
            IUserDataRepository userDataRepository,
            IExposureRiskCalculationConfigurationRepository exposureRiskCalculationConfigurationRepository,
            IDateTimeUtility dateTimeUtility
            ) : base(navigationService)
        {
            _loggerService                  = loggerService;
            _exposureDataRepository         = exposureDataRepository;
            _exposureRiskCalculationService = exposureRiskCalculationService;
            _localPathService               = localPathService;
            _exposureDataExportService      = exposureDataExportService;
            _userDataRepository             = userDataRepository;
            _exposureRiskCalculationConfigurationRepository = exposureRiskCalculationConfigurationRepository;
            _dateTimeUtility = dateTimeUtility;

            ExposureCheckScores = new ObservableCollection <ExposureCheckScoreModel>();
            UtcDescription      = string.Format(
                AppResources.LowRiskContactPageAnnotationDecription2,
                TimeZoneInfo.Local.StandardName
                );
        }
Exemplo n.º 3
0
 public DataMaintainanceBackgroundService(
     ILoggerService loggerService,
     IEventLogRepository eventLogRepository,
     IDateTimeUtility dateTimeUtility
     ) : base(loggerService, eventLogRepository)
 {
     _dateTimeUtility = dateTimeUtility;
 }
Exemplo n.º 4
0
        private static CourseListViewModel CreateViewModel(
            ICourseUpdater courseUpdater          = null,
            ICourseRepository repository          = null,
            IPreferencesUtility preferences       = null,
            IDateTimeUtility dateTime             = null,
            IDbConnection dbConnection            = null,
            ISecureStorageUtility secureStorage   = null,
            IBackgroundSyncUtility backgroundSync = null,
            IMessenger messenger = null
            )
        {
            if (courseUpdater == null)
            {
                courseUpdater = Substitute.For <ICourseUpdater>();

                courseUpdater.TryUpdateAsync().Returns(
                    Task.FromResult(Result.WithSuccess(new CourseUpdateInfo(true)))
                    );
            }

            if (repository == null)
            {
                repository = Substitute.For <ICourseRepository>();
                repository.All().Returns(new Course[0]);
            }

            var utcNow = DateTime.UtcNow;

            if (dateTime == null)
            {
                dateTime = Substitute.For <IDateTimeUtility>();
                dateTime.UtcNow.Returns(utcNow);
            }

            if (preferences == null)
            {
                preferences = Substitute.For <IPreferencesUtility>();
                preferences.LastCourseUpdateCheck.CompareTo(utcNow.AddMinutes(-30));
            }

            dbConnection   = dbConnection ?? Substitute.For <IDbConnection>();
            secureStorage  = secureStorage ?? Substitute.For <ISecureStorageUtility>();
            backgroundSync = backgroundSync ?? Substitute.For <IBackgroundSyncUtility>();
            messenger      = messenger ?? Substitute.For <IMessenger>();

            return(new CourseListViewModel(
                       courseUpdater,
                       repository,
                       preferences,
                       dateTime,
                       dbConnection,
                       secureStorage,
                       backgroundSync,
                       messenger
                       ));
        }
Exemplo n.º 5
0
 public ExposureDataRepository(
     ISecureStorageService secureStorageService,
     IDateTimeUtility dateTimeUtility,
     ILoggerService loggerService
     )
 {
     _secureStorageService = secureStorageService;
     _dateTimeUtility      = dateTimeUtility;
     _loggerService        = loggerService;
 }
Exemplo n.º 6
0
 public UserDataRepository(
     IPreferencesService preferencesService,
     IDateTimeUtility dateTimeUtility,
     ILoggerService loggerService
     )
 {
     _preferencesService = preferencesService;
     _dateTimeUtility    = dateTimeUtility;
     _loggerService      = loggerService;
 }
Exemplo n.º 7
0
 public EventLogRepository(
     ISendEventLogStateRepository sendEventLogStateRepository,
     IDateTimeUtility dateTimeUtility,
     ILocalPathService localPathService,
     ILoggerService loggerService,
     IBackupAttributeService backupAttributeService
     )
 {
     _sendEventLogStateRepository = sendEventLogStateRepository;
     _dateTimeUtility             = dateTimeUtility;
     _basePath               = localPathService.EventLogDirPath;
     _loggerService          = loggerService;
     _backupAttributeService = backupAttributeService;
 }
Exemplo n.º 8
0
 public CourseUpdater(
     ICoursePageHtmlDownloader downloader,
     ICoursePageHtmlParser parser,
     ICourseSetComparer comparer,
     ICourseRepository repository,
     IUnitOfWork unitOfWork,
     IDateTimeUtility dateTime,
     IPreferencesUtility preferences
     )
 {
     _downloader  = downloader;
     _parser      = parser;
     _comparer    = comparer;
     _repository  = repository;
     _unitOfWork  = unitOfWork;
     _dateTime    = dateTime;
     _preferences = preferences;
 }
Exemplo n.º 9
0
        public EventLogService(
            IUserDataRepository userDataRepository,
            IServerConfigurationRepository serverConfigurationRepository,
            IEssentialsService essentialsService,
            IDeviceVerifier deviceVerifier,
            IDateTimeUtility dateTimeUtility,
            IHttpClientService httpClientService,
            ILoggerService loggerService
            )
        {
            _userDataRepository            = userDataRepository;
            _serverConfigurationRepository = serverConfigurationRepository;
            _essentialsService             = essentialsService;
            _deviceVerifier  = deviceVerifier;
            _dateTimeUtility = dateTimeUtility;
            _loggerService   = loggerService;

            _httpClient = httpClientService.Create();
        }
Exemplo n.º 10
0
        public ExposureCheckPageViewModel(
            INavigationService navigationService,
            ILoggerService loggerService,
            IExposureDataRepository exposureDataRepository,
            IExposureRiskCalculationService exposureRiskCalculationService,
            IUserDataRepository userDataRepository,
            IExposureRiskCalculationConfigurationRepository exposureRiskCalculationConfigurationRepository,
            IDateTimeUtility dateTimeUtility
            ) : base(navigationService)
        {
            _loggerService                  = loggerService;
            _exposureDataRepository         = exposureDataRepository;
            _exposureRiskCalculationService = exposureRiskCalculationService;
            _userDataRepository             = userDataRepository;
            _exposureRiskCalculationConfigurationRepository = exposureRiskCalculationConfigurationRepository;
            _dateTimeUtility = dateTimeUtility;

            ExposureCheckScores = new ObservableCollection <ExposureCheckScoreModel>();
        }
 public AbsExposureDetectionBackgroundService(
     IDiagnosisKeyRepository diagnosisKeyRepository,
     AbsExposureNotificationApiService exposureNotificationApiService,
     IExposureConfigurationRepository exposureConfigurationRepository,
     ILoggerService loggerService,
     IUserDataRepository userDataRepository,
     IServerConfigurationRepository serverConfigurationRepository,
     ILocalPathService localPathService,
     IDateTimeUtility dateTimeUtility
     )
 {
     _diagnosisKeyRepository          = diagnosisKeyRepository;
     _exposureNotificationApiService  = exposureNotificationApiService;
     _exposureConfigurationRepository = exposureConfigurationRepository;
     _loggerService                 = loggerService;
     _userDataRepository            = userDataRepository;
     _serverConfigurationRepository = serverConfigurationRepository;
     _localPathService              = localPathService;
     _dateTimeUtility               = dateTimeUtility;
 }
        public ExposureConfigurationRepository(
            IHttpClientService httpClientService,
            ILocalPathService localPathService,
            IPreferencesService preferencesService,
            IServerConfigurationRepository serverConfigurationRepository,
            IDateTimeUtility dateTimeUtility,
            ILoggerService loggerService
            )
        {
            _localPathService              = localPathService;
            _preferencesService            = preferencesService;
            _serverConfigurationRepository = serverConfigurationRepository;
            _dateTimeUtility = dateTimeUtility;
            _loggerService   = loggerService;

            _httpClient         = httpClientService.Create();
            _httpClient.Timeout = TimeSpan.FromSeconds(TIMEOUT_SECONDS);

            _configDir = PrepareConfigDir();
            _currentExposureConfigurationPath = localPathService.CurrentExposureConfigurationPath;
        }
Exemplo n.º 13
0
 public ExposureDetectionBackgroundServiceMock(
     IDiagnosisKeyRepository diagnosisKeyRepository,
     AbsExposureNotificationApiService exposureNotificationApiService,
     IExposureConfigurationRepository exposureConfigurationRepository,
     ILoggerService loggerService,
     IUserDataRepository userDataRepository,
     IServerConfigurationRepository serverConfigurationRepository,
     ILocalPathService localPathService,
     IDateTimeUtility dateTimeUtility
     ) : base(
         diagnosisKeyRepository,
         exposureNotificationApiService,
         exposureConfigurationRepository,
         loggerService,
         userDataRepository,
         serverConfigurationRepository,
         localPathService,
         dateTimeUtility
         )
 {
 }
Exemplo n.º 14
0
        public CourseListViewModel(
            ICourseUpdater courseUpdater,
            ICourseRepository repository,
            IPreferencesUtility preferences,
            IDateTimeUtility dateTime,
            IDbConnection dbConnection,
            ISecureStorageUtility secureStorage,
            IBackgroundSyncUtility backgroundSync,
            IMessenger messenger
            )
        {
            _courseUpdater  = courseUpdater;
            _repository     = repository;
            _preferences    = preferences;
            _dateTime       = dateTime;
            _dbConnection   = dbConnection;
            _secureStorage  = secureStorage;
            _backgroundSync = backgroundSync;
            _messenger      = messenger;

            Courses = new CourseListItem[0];
        }
Exemplo n.º 15
0
 public ExposureDetectionService
 (
     ILoggerService loggerService,
     ISendEventLogStateRepository sendEventLogStateRepository,
     IExposureDataRepository exposureDataRepository,
     ILocalNotificationService localNotificationService,
     IExposureRiskCalculationConfigurationRepository exposureRiskCalculationConfigurationRepository,
     IExposureRiskCalculationService exposureRiskCalculationService,
     IExposureConfigurationRepository exposureConfigurationRepository,
     IEventLogRepository eventLogRepository,
     IDateTimeUtility dateTimeUtility
 )
 {
     _loggerService = loggerService;
     _sendEventLogStateRepository    = sendEventLogStateRepository;
     _exposureDataRepository         = exposureDataRepository;
     _localNotificationService       = localNotificationService;
     _exposureRiskCalculationService = exposureRiskCalculationService;
     _exposureRiskCalculationConfigurationRepository = exposureRiskCalculationConfigurationRepository;
     _exposureConfigurationRepository = exposureConfigurationRepository;
     _eventLogRepository = eventLogRepository;
     _dateTimeUtility    = dateTimeUtility;
 }
Exemplo n.º 16
0
        private static CourseUpdater CreateCourseUpdater(
            ICoursePageHtmlDownloader downloader = null,
            ICoursePageHtmlParser parser         = null,
            ICourseSetComparer comparer          = null,
            ICourseRepository repository         = null,
            IUnitOfWork unitOfWork          = null,
            IDateTimeUtility dateTime       = null,
            IPreferencesUtility preferences = null
            )
        {
            if (downloader == null)
            {
                downloader = Substitute.For <ICoursePageHtmlDownloader>();

                downloader.TryDownloadCoursePageHtmlAsync(Arg.Any <string>())
                .Returns(Task.FromResult(Result.WithSuccess <string>()));
            }

            if (parser == null)
            {
                parser = Substitute.For <ICoursePageHtmlParser>();

                parser.TryParseCoursePage(Arg.Any <string>())
                .Returns(Result.WithSuccess(new RawCourse[0]));
            }

            if (repository == null)
            {
                repository = Substitute.For <ICourseRepository>();
                repository.All().Returns(new Course[0]);
            }

            if (unitOfWork == null)
            {
                unitOfWork = Substitute.For <IUnitOfWork>();

                var session = Substitute.For <IUnitOfWorkSession>();
                unitOfWork.OpenSession().Returns(session);

                session.Commit().Returns(Result.Success);
            }

            if (dateTime == null)
            {
                dateTime = Substitute.For <IDateTimeUtility>();
                dateTime.UtcNow.Returns(DateTime.UtcNow);
            }

            comparer    = comparer ?? new CourseSetComparer();
            preferences = preferences ?? Substitute.For <IPreferencesUtility>();

            return(new CourseUpdater(
                       downloader,
                       parser,
                       comparer,
                       repository,
                       unitOfWork,
                       dateTime,
                       preferences
                       ));
        }