public void RecalculateAllPointsForGamesWithNoPlayTime()
        {
            //--arrange
            using (var dbContext = new NemeStatsDbContext())
            {
                using (var dataContext = new NemeStatsDataContext(dbContext, new SecuredEntityValidatorFactory()))
                {
                    var weightTierCalculator        = new WeightTierCalculator();
                    var weightBonusCalculator       = new WeightBonusCalculator(weightTierCalculator);
                    var gameDurationBonusCalculator = new GameDurationBonusCalculator();
                    var pointsCalculator            = new PointsCalculator(weightBonusCalculator, gameDurationBonusCalculator);

                    //--act
                    new GlobalPointsRecalculator().RecalculateAllPointsForGamesWithNoPlayTime(dataContext, pointsCalculator);
                }
            }
        }
        public override AchievementAwarded IsAwardedForThisPlayer(int playerId)
        {
            var result = new AchievementAwarded
            {
                AchievementId = Id
            };

            var allWeightedGames =
                DataContext
                .GetQueryable <PlayerGameResult>()
                .Where(x => x.PlayerId == playerId)
                .GroupBy(x => new {
                // World's best change
                WeightTier = WeightTierCalculator.GetTheRealWeightTier(x.PlayedGame.GameDefinition.BoardGameGeekGameDefinition.AverageWeight)
            })
                .Select(group => new { group.Key, Count = group.Count() })
                .ToList();

            var noUnknownGames =
                (from item in allWeightedGames
                 where item.Key.WeightTier != WeightTierEnum.Unknown
                 select item).ToList();


            if (noUnknownGames.Count == 5)
            {
                result.PlayerProgress = noUnknownGames.Min(p => p.Count);
            }
            else
            {
                return(result);
            }

            result.LevelAwarded = GetLevelAwarded(result.PlayerProgress);

            return(result);
        }
 public void SetUp()
 {
     _calculator = new WeightTierCalculator();
 }