예제 #1
0
        private void InitializeServices()
        {
            _trackingService = new TrackingUserApplicationService(ServiceLocator.GetInstance <IAppUsageRecordRepository>(), ServiceLocator.GetInstance <IAppUsageRecordRepository>("LocalRepository"));

            Task.Run(() =>
            {
                _trackingService.StartTracking();
            });

            ChromeTabBlockingService.Instance.StartListening();
        }
예제 #2
0
        void BufferPersistentRecords_should_return_from_main_repository()
        {
            var mockMainRepository   = new Mock <IAppUsageRecordRepository>();
            var mockBackupRepository = new Mock <IAppUsageRecordRepository>();
            TrackingUserApplicationService _service = new TrackingUserApplicationService(mockMainRepository.Object, mockBackupRepository.Object);

            var appUsageRecord = new AppUsageRecord(DateTime.Now);

            mockMainRepository.Setup(r => r.Get(AppUsageRecord.GetGeneratedId(DateTime.Now))).Returns(appUsageRecord);
            mockBackupRepository.Setup(r => r.Get(AppUsageRecord.GetGeneratedId(DateTime.Now))).Returns <AppUsageRecord>(null);

            _service.BufferPersistentRecords();

            var bufferedRecord = _service.GetBufferedRecord();

            Assert.Equal(appUsageRecord.Id, bufferedRecord.Id);
            Assert.Equal(appUsageRecord.Date, bufferedRecord.Date);
            Assert.Equal(appUsageRecord.ActiveApps, bufferedRecord.ActiveApps);
        }
예제 #3
0
 void Instantiate_service_successfully()
 {
     var mockMainRepository   = new Mock <IAppUsageRecordRepository>();
     var mockBackupRepository = new Mock <IAppUsageRecordRepository>();
     TrackingUserApplicationService _service = new TrackingUserApplicationService(mockMainRepository.Object, mockBackupRepository.Object);
 }