GetPlayerDetails() public method

public GetPlayerDetails ( int playerId, int numberOfRecentGamesToRetrieve ) : PlayerDetails
playerId int
numberOfRecentGamesToRetrieve int
return BusinessLogic.Models.Players.PlayerDetails
        public void ItEagerlyFetchesPlayedGames()
        {
            using (NemeStatsDbContext dbContext = new NemeStatsDbContext())
            {
                using (IDataContext dataContext = new NemeStatsDataContext(dbContext, securedEntityValidatorFactory))
                {
                    dbContext.Configuration.LazyLoadingEnabled = false;
                    dbContext.Configuration.ProxyCreationEnabled = false;
                    INemesisHistoryRetriever nemesisHistoryRetriever = new NemesisHistoryRetriever(dataContext);
                    IPlayerRepository playerRepository = new EntityFrameworkPlayerRepository(dataContext);
                    IPlayedGameRetriever playedGameRetriever = new PlayedGameRetriever(dataContext);
                    IPlayerRetriever playerRetriever = new PlayerRetriever(dataContext, playerRepository, playedGameRetriever);
                    PlayerDetails testPlayerDetails = playerRetriever.GetPlayerDetails(testPlayer1.Id, 1);

                    Assert.NotNull(testPlayerDetails.PlayerGameResults.First().PlayedGame);
                }
            }
        }
        public void ItSetsPlayerStatistics()
        {
            using (NemeStatsDbContext dbContext = new NemeStatsDbContext())
            {
                using (IDataContext dataContext = new NemeStatsDataContext(dbContext, securedEntityValidatorFactory))
                {
                    INemesisHistoryRetriever nemesisHistoryRetriever = new NemesisHistoryRetriever(dataContext);
                    IPlayerRepository playerRepository = new EntityFrameworkPlayerRepository(dataContext);
                    IPlayedGameRetriever playedGameRetriever = new PlayedGameRetriever(dataContext);
                    IPlayerRetriever playerRetriever = new PlayerRetriever(dataContext,  playerRepository, playedGameRetriever);
                    PlayerDetails playerDetails = playerRetriever.GetPlayerDetails(testPlayer1.Id, 1);

                    Assert.NotNull(playerDetails.PlayerStats);
                }
            }
        }
        public void ItOrdersPlayerGameResultsByTheDatePlayedDescending()
        {
            using (NemeStatsDbContext dbContext = new NemeStatsDbContext())
            {
                using (IDataContext dataContext = new NemeStatsDataContext(dbContext, securedEntityValidatorFactory))
                {
                    int numberOfGamesToRetrieve = 3;

                    INemesisHistoryRetriever nemesisHistoryRetriever = new NemesisHistoryRetriever(dataContext);
                    IPlayerRepository playerRepository = new EntityFrameworkPlayerRepository(dataContext);
                    IPlayedGameRetriever playedGameRetriever = new PlayedGameRetriever(dataContext);
                    IPlayerRetriever playerRetriever = new PlayerRetriever(dataContext, playerRepository, playedGameRetriever);
                    PlayerDetails playerDetails = playerRetriever.GetPlayerDetails(testPlayer1.Id, numberOfGamesToRetrieve);

                    long lastTicks = long.MaxValue; ;
                    Assert.IsTrue(playerDetails.PlayerGameResults.Count == numberOfGamesToRetrieve);
                    foreach (PlayerGameResult result in playerDetails.PlayerGameResults)
                    {
                        Assert.GreaterOrEqual(lastTicks, result.PlayedGame.DatePlayed.Ticks);

                        lastTicks = result.PlayedGame.DatePlayed.Ticks;
                    }
                }
            }
        }
        public void ItOnlyGetsTheSpecifiedNumberOfRecentGames()
        {
            using (NemeStatsDbContext dbContext = new NemeStatsDbContext())
            {
                using (IDataContext dataContext = new NemeStatsDataContext(dbContext, securedEntityValidatorFactory))
                {
                    int numberOfGamesToRetrieve = 1;

                    INemesisHistoryRetriever nemesisHistoryRetriever = new NemesisHistoryRetriever(dataContext);
                    IPlayerRepository playerRepository = new EntityFrameworkPlayerRepository(dataContext);
                    IPlayedGameRetriever playedGameRetriever = new PlayedGameRetriever(dataContext);
                    IPlayerRetriever playerRetriever = new PlayerRetriever(dataContext, playerRepository, playedGameRetriever);
                    PlayerDetails playerDetails = playerRetriever.GetPlayerDetails(testPlayer1.Id, numberOfGamesToRetrieve);

                    Assert.AreEqual(numberOfGamesToRetrieve, playerDetails.PlayerGameResults.Count);
                }
            }
        }