コード例 #1
0
        public void UpdateUserFactsWhenUserHasNoUpdatedTrackers_FactsInRepositoryNotUpdated()
        {
            var generalFact = CreateGeneralFact();

            _multipleFactsRepository.CreateUserGeneralFacts(_tracker.CreatorId, new[] { generalFact });
            var specificFact = CreateSpecificFact();

            _singleFactsRepository.CreateTrackerSpecificFacts(_tracker.Id, _tracker.CreatorId, new[] { specificFact });
            _tracker.IsUpdated = false;
            _trackerRepository.UpdateTracker(_tracker);

            _statisticGenerator.UpdateUserFacts(_tracker.CreatorId);
            var loadedGeneralFact  = _multipleFactsRepository.ReadUserGeneralFacts(_tracker.CreatorId);
            var loadedSpecificFact = _singleFactsRepository.ReadTrackerSpecificFacts(_tracker.CreatorId, _tracker.Id);

            Assert.AreEqual(generalFact.GetHashCode(), loadedGeneralFact.First().GetHashCode());
            Assert.AreEqual(specificFact.GetHashCode(), loadedSpecificFact.First().GetHashCode());
        }
コード例 #2
0
        public IReadOnlyCollection <IMultipleTrackersFact> GetMultipleTrackersFacts(Guid userId)
        {
            if (!_multipleFactsRepository.IsContainFactsForUser(userId))
            {
                throw new UserTrackersStatisticsNotFoundException(userId);
            }

            var statisticFacts = _multipleFactsRepository.ReadUserGeneralFacts(userId);

            return(statisticFacts);
        }