public override void FixtureSetUp()
        {
            base.FixtureSetUp();

            dataContext = new NemeStatsDataContext();
            IPlayerRepository playerRepository = new EntityFrameworkPlayerRepository(dataContext);
            IPlayedGameRetriever playedGameRetriever = new PlayedGameRetriever(dataContext);
            playerRetriever = new PlayerRetriever(dataContext, playerRepository, playedGameRetriever);
            player1Details = playerRetriever.GetPlayerDetails(testPlayer1.Id, 0);
            player5Details = playerRetriever.GetPlayerDetails(testPlayer5.Id, 0);
        }
        public override void SetUp()
        {
            base.SetUp();

            playerDetails = new PlayerDetails
            {
                Name = "player name",
                Id = playerId
            };
            autoMocker.Get<IPlayerRetriever>().Expect(mock => mock.GetPlayerDetails(playerId, 0))
                              .Return(playerDetails);
        }
Exemplo n.º 3
0
        public void ItLoadsTheEditView()
        {
            int playerId = 123;
            autoMocker.Get<IPlayerRetriever>().Expect(mock => mock.GetPlayerDetails(playerId, 0))
                .Return(new PlayerDetails() {PlayerGameSummaries = new List<PlayerGameSummary>()});

            PlayerDetails playerDetails = new PlayerDetails
            {
                Id = playerId
            };

            ViewResult result = autoMocker.ClassUnderTest.Edit(playerDetails.Id) as ViewResult;

            Assert.AreEqual(MVC.Player.Views.Edit, result.ViewName);
        }
        public PlayerDetailsViewModel Build(PlayerDetails playerDetails, string urlForMinionBragging, ApplicationUser currentUser = null)
        {
            Validate(playerDetails);

            var playerDetailsViewModel = new PlayerDetailsViewModel
            {
                PlayerId = playerDetails.Id,
                PlayerName = playerDetails.Name,
                PlayerRegistered = playerDetails.ApplicationUserId != null,
                Active = playerDetails.Active,
                GamingGroupName = playerDetails.GamingGroupName,
                GamingGroupId = playerDetails.GamingGroupId,
                TotalGamesPlayed = playerDetails.PlayerStats.TotalGames,
                NemePointsSummary = new NemePointsSummaryViewModel(playerDetails.NemePointsSummary),
                TotalGamesWon = playerDetails.PlayerStats.TotalGamesWon,
                TotalGamesLost = playerDetails.PlayerStats.TotalGamesLost,
                WinPercentage = playerDetails.PlayerStats.WinPercentage,
                TotalChampionedGames = playerDetails.ChampionedGames.Count,
                LongestWinningStreak = playerDetails.LongestWinningStreak,
                PlayerAchievements = playerDetails.Achievements?.Select(pa => _mapperFactory.GetMapper<PlayerAchievement,PlayerAchievementSummaryViewModel>().Map(pa)).OrderByDescending(a=>a.AchievementLevel).ThenByDescending(a=>a.LastUpdatedDate).ToList() ?? new List<PlayerAchievementSummaryViewModel>()
            };

            PopulatePlayerVersusPlayersViewModel(playerDetails, playerDetailsViewModel);

            SetTwitterBraggingUrlIfThePlayerIsTheCurrentlyLoggedInUser(playerDetails, urlForMinionBragging, currentUser, playerDetailsViewModel);

            SetAveragePointsPerGame(playerDetails, playerDetailsViewModel);
            playerDetailsViewModel.AveragePlayersPerGame = playerDetails.PlayerStats.AveragePlayersPerGame;
            SetAveragePointsPerPlayer(playerDetails, playerDetailsViewModel);
            SetUserCanEditFlag(playerDetails, currentUser, playerDetailsViewModel);

            PopulatePlayerGameResults(playerDetails, playerDetailsViewModel);

            PopulateNemesisData(playerDetails.CurrentNemesis, playerDetailsViewModel);

            playerDetailsViewModel.Minions = (from Player player in playerDetails.Minions
                                              select _minionViewModelBuilder.Build(player)).ToList();

            playerDetailsViewModel.PlayerGameSummaries = playerDetails.PlayerGameSummaries.Select(Mapper.Map<PlayerGameSummaryViewModel>).ToList();

            SetChampionedGames(playerDetails, playerDetailsViewModel);

            SetFormerChampionedGames(playerDetails, playerDetailsViewModel);

            return playerDetailsViewModel;
        }
Exemplo n.º 5
0
        public void ItReturnsThePlayerDetailsViewWhenThePlayerIsFound()
        {
            PlayerDetails playerDetails = new PlayerDetails(){ PlayerGameResults = new List<PlayerGameResult>() };
            autoMocker.Get<IPlayerRetriever>().Expect(playerLogic => playerLogic.GetPlayerDetails(playerId, PlayerController.NUMBER_OF_RECENT_GAMES_TO_RETRIEVE))
                .Repeat.Once()
                .Return(playerDetails);

            PlayerDetailsViewModel playerDetailsViewModel = new PlayerDetailsViewModel()
            {
                PlayerId = playerId,
                PlayerGameResultDetails = new List<GameResultViewModel>()
            };
            autoMocker.Get<IPlayerDetailsViewModelBuilder>().Expect(viewModelBuilder => viewModelBuilder.Build(playerDetails, expectedMinionUrl, currentUser))
                .Repeat
                .Once()
                .Return(playerDetailsViewModel);
            ViewResult viewResult = autoMocker.ClassUnderTest.Details(playerId, currentUser) as ViewResult;

            Assert.AreEqual(MVC.Player.Views.Details, viewResult.ViewName);
        }
Exemplo n.º 6
0
        public void MinionsCannotBeNull()
        {
            var builder = new PlayerDetailsViewModelBuilder(null, null, null);
            var playerDetailsWithNoMinions = new PlayerDetails() { PlayerGameResults = new List<PlayerGameResult>() };
            playerDetailsWithNoMinions.PlayerStats = new PlayerStatistics();

            var exception = Assert.Throws<ArgumentException>(() =>
                    builder.Build(playerDetailsWithNoMinions, twitterMinionBraggingUrl, currentUser));

            Assert.AreEqual(PlayerDetailsViewModelBuilder.EXCEPTION_MINIONS_CANNOT_BE_NULL, exception.Message);
        }
Exemplo n.º 7
0
        public void ItRequiresPlayerStatistics()
        {
            var builder = new PlayerDetailsViewModelBuilder(null, null, null);
            var playerDetailsWithNoStatistics = new PlayerDetails() { PlayerGameResults = new List<PlayerGameResult>() };
            var exception = Assert.Throws<ArgumentException>(() =>
                    builder.Build(playerDetailsWithNoStatistics, twitterMinionBraggingUrl, currentUser));

            Assert.AreEqual(PlayerDetailsViewModelBuilder.EXCEPTION_PLAYER_STATISTICS_CANNOT_BE_NULL, exception.Message);
        }
 private void PopulatePlayerGameResults(PlayerDetails playerDetails, PlayerDetailsViewModel playerDetailsViewModel)
 {
     playerDetailsViewModel.PlayerGameResultDetails = new List<GameResultViewModel>();
     GameResultViewModel gameResultViewModel;
     foreach (PlayerGameResult playerGameResult in playerDetails.PlayerGameResults)
     {
         gameResultViewModel = _gameResultViewModelBuilder.Build(playerGameResult);
         playerDetailsViewModel.PlayerGameResultDetails.Add(gameResultViewModel);
     }
 }
 private static void SetAveragePointsPerPlayer(PlayerDetails playerDetails, PlayerDetailsViewModel playerDetailsViewModel)
 {
     if (playerDetails.PlayerStats.AveragePlayersPerGame == 0)
     {
         playerDetailsViewModel.AveragePointsPerPlayer = 0;
     }
     else
     {
         playerDetailsViewModel.AveragePointsPerPlayer
             = playerDetailsViewModel.AveragePointsPerGame / playerDetails.PlayerStats.AveragePlayersPerGame;
     }
 }
 private static void ValidatePlayerGameResultsIsNotNull(PlayerDetails playerDetails)
 {
     if (playerDetails.PlayerGameResults == null)
     {
         throw new ArgumentException(EXCEPTION_PLAYER_GAME_RESULTS_CANNOT_BE_NULL);
     }
 }
 private static void SetTwitterBraggingUrlIfThePlayerIsTheCurrentlyLoggedInUser(PlayerDetails playerDetails,
                                                                                string urlForMinionBragging,
                                                                                ApplicationUser currentUser,
                                                                                PlayerDetailsViewModel playerDetailsViewModel)
 {
     if (currentUser != null && currentUser.Id == playerDetails.ApplicationUserId)
     {
         playerDetailsViewModel.MinionBraggingTweetUrl = urlForMinionBragging;
     }
 }
 private static void Validate(PlayerDetails playerDetails)
 {
     ValidatePlayerDetailsIsNotNull(playerDetails);
     ValidatePlayerGameResultsIsNotNull(playerDetails);
     ValidatePlayerStatisticsIsNotNull(playerDetails);
     ValidateMinions(playerDetails);
     ValidateChampionedGames(playerDetails);
     ValidateFormerChampionedGames(playerDetails);
 }
 private static void ValidatePlayerDetailsIsNotNull(PlayerDetails playerDetails)
 {
     if (playerDetails == null)
     {
         throw new ArgumentNullException("playerDetails");
     }
 }
 private void SetFormerChampionedGames(PlayerDetails playerDetails, PlayerDetailsViewModel playerDetailsViewModel)
 {
     if (playerDetails.PlayerGameSummaries == null)
     {
         return;
     }
     playerDetailsViewModel.PlayerGameSummaries
         .Where(summary => playerDetails.FormerChampionedGames.Select(fcg => fcg.Id).Contains(summary.GameDefinitionId)
             //take the current champion out of the former champions list
             && !summary.IsChampion)
         .ToList()
         .ForEach(x => x.IsFormerChampion = true);
 }
 private void SetChampionedGames(PlayerDetails playerDetails, PlayerDetailsViewModel playerDetailsViewModel)
 {
     if (playerDetails.PlayerGameSummaries == null)
     {
         return;
     }
     playerDetailsViewModel.PlayerGameSummaries
         .Where(summary => playerDetails.ChampionedGames
                             .Select(championedGame => championedGame.GameDefinitionId)
                             .Contains(summary.GameDefinitionId))
         .ToList()
         .ForEach(x => x.IsChampion = true);
 }
 private static void SetUserCanEditFlag(PlayerDetails playerDetails, ApplicationUser currentUser, PlayerDetailsViewModel playerDetailsViewModel)
 {
     if (currentUser == null || playerDetails.GamingGroupId != currentUser.CurrentGamingGroupId)
     {
         playerDetailsViewModel.UserCanEdit = false;
     }
     else
     {
         playerDetailsViewModel.UserCanEdit = true;
     }
 }
Exemplo n.º 17
0
        public void FormerChampionedGamesCannotBeNull()
        {
            var builder = new PlayerDetailsViewModelBuilder(null, null, null);
            var playerDetailsWithNoChampionedGames = new PlayerDetails()
            {
                PlayerGameResults = new List<PlayerGameResult>(),
                PlayerStats = new PlayerStatistics(),
                Minions = new List<Player>(),
                ChampionedGames = new List<Champion>()
            };

            var exception = Assert.Throws<ArgumentException>(() =>
                    builder.Build(playerDetailsWithNoChampionedGames, twitterMinionBraggingUrl, currentUser));

            Assert.AreEqual(PlayerDetailsViewModelBuilder.EXCEPTION_FORMERCHAMPIONED_GAMES_CANNOT_BE_NULL, exception.Message);
        }
 private static void ValidatePlayerStatisticsIsNotNull(PlayerDetails playerDetails)
 {
     if (playerDetails.PlayerStats == null)
     {
         throw new ArgumentException(EXCEPTION_PLAYER_STATISTICS_CANNOT_BE_NULL);
     }
 }
Exemplo n.º 19
0
        public void TestFixtureSetUp()
        {
            AutomapperConfiguration.Configure();
            minionViewModelBuilderMock = MockRepository.GenerateMock<IMinionViewModelBuilder>();
            mapperFactory = MockRepository.GenerateStub<IMapperFactory>();

            currentUser = new ApplicationUser()
            {
                CurrentGamingGroupId = gamingGroupId,
                Id = "application user id"
            };

            var gameDefinition1 = new GameDefinition()
            {
                Name = "test game 1",
                Id = gameDefinitionIdThatIsChampionedByCurrentPlayer,
            };
            gameDefinitionThatIsFormerlyChampionedByCurrentPlayer = new GameDefinition
            {
                Name = "formerly championed game",
                Id = gameDefinitionIdThatIsFormerlyChampionedByCurrentPlayer
            };
            gameDefinitionThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer = new GameDefinition
            {
                Name = "currently and formerly championed game",
                Id = gameDefinitionIdThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer
            };
            var playedGame1 = new PlayedGame()
            {
                Id = 1,
                GameDefinition = gameDefinition1
            };

            var playedGame2 = new PlayedGame()
            {
                Id = 2,
                GameDefinitionId = gameDefinitionIdThatIsFormerlyChampionedByCurrentPlayer
            };
            var playerGameResults = new List<PlayerGameResult>()
            {
                new PlayerGameResult(){ PlayedGameId = 12, PlayedGame = playedGame1 },
                new PlayerGameResult(){ PlayedGameId = 13, PlayedGame = playedGame2 }
            };

            normalPlayer = new PlayerVersusPlayerStatistics
            {
                OpposingPlayerName = "Jim",
                OpposingPlayerId = 1,
                OpposingPlayerActive = false,
                NumberOfGamesWonVersusThisPlayer = 10,
                NumberOfGamesLostVersusThisPlayer = 10
            };

            playerWithNoGamesPlayed = new PlayerVersusPlayerStatistics
            {
                OpposingPlayerId = 2
            };

            minionPlayer = new PlayerVersusPlayerStatistics
            {
                OpposingPlayerName = "Minion Player",
                OpposingPlayerId = 5,
                NumberOfGamesWonVersusThisPlayer = 20,
                NumberOfGamesLostVersusThisPlayer = 0
            };

            nemesisPlayer = new PlayerVersusPlayerStatistics
            {
                OpposingPlayerName = "nemesis player",
                OpposingPlayerId = 3,
                NumberOfGamesWonVersusThisPlayer = 0,
                NumberOfGamesLostVersusThisPlayer = 100
            };

            previousNemesisPlayer = new PlayerVersusPlayerStatistics

            {
                OpposingPlayerName = "Previous Nemesis Player",
                OpposingPlayerId = 13,
                NumberOfGamesWonVersusThisPlayer = 0,
                NumberOfGamesLostVersusThisPlayer = 42
            };

            var nemesis = new Nemesis()
            {
                NemesisPlayerId = nemesisPlayer.OpposingPlayerId,
                NumberOfGamesLost = 3,
                LossPercentage = 75,
                NemesisPlayer = new Player()
                {
                    Name = "Ace Nemesis",
                }
            };

            var previousNemesis = new Nemesis()
            {
                NemesisPlayerId = previousNemesisPlayer.OpposingPlayerId,
                NumberOfGamesLost = 5,
                LossPercentage = 66,
                NemesisPlayer = new Player()
                {
                    Name = "Bravo Nemesis",
                }
            };

            playerDetails = new PlayerDetails()
            {
                Id = playerId,
                ApplicationUserId = currentUser.Id,
                Active = true,
                Name = "Skipper",
                LongestWinningStreak = 39,
                PlayerGameResults = playerGameResults,
                PlayerStats = new PlayerStatistics()
                {
                    TotalGames = 5,
                    NemePointsSummary = new NemePointsSummary(1, 3, 5),
                    AveragePlayersPerGame = 3,
                    TotalGamesLost = 1,
                    TotalGamesWon = 4,
                    WinPercentage = 20
                },
                CurrentNemesis = nemesis,
                PreviousNemesis = previousNemesis,
                Minions = new List<Player>
                {
                    new Player
                    {
                        Id = minionPlayer.OpposingPlayerId
                    }
                },
                GamingGroupId = gamingGroupId,
                GamingGroupName = "gaming group name",
                PlayerVersusPlayersStatistics = new List<PlayerVersusPlayerStatistics>
                {
                    normalPlayer,
                    playerWithNoGamesPlayed,
                    nemesisPlayer,
                    previousNemesisPlayer,
                    minionPlayer
                },
                PlayerGameSummaries = new List<PlayerGameSummary>
                {
                    new PlayerGameSummary
                    {
                        GameDefinitionId = gameDefinitionIdThatIsChampionedByCurrentPlayer
                    },
                    new PlayerGameSummary
                    {
                        GameDefinitionId = gameDefinitionIdThatIsFormerlyChampionedByCurrentPlayer
                    },
                    new PlayerGameSummary
                    {
                        GameDefinitionId = gameDefinitionIdThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer
                    }
                },
                NemePointsSummary = new NemePointsSummary(1, 3, 5)
            };

            gameResultViewModelBuilder
                = MockRepository.GenerateMock<IGameResultViewModelBuilder>();
            gameResultViewModelBuilder.Expect(build => build.Build(playerGameResults[0]))
                    .Repeat
                    .Once()
                    .Return(new Models.PlayedGame.GameResultViewModel() { PlayedGameId = playerGameResults[0].PlayedGameId });
            gameResultViewModelBuilder.Expect(build => build.Build(playerGameResults[1]))
                    .Repeat
                    .Once()
                    .Return(new Models.PlayedGame.GameResultViewModel() { PlayedGameId = playerGameResults[1].PlayedGameId });
            foreach (var player in playerDetails.Minions)
            {
                minionViewModelBuilderMock.Expect(mock => mock.Build(player))
                    .Return(new MinionViewModel() { MinionPlayerId = player.Id });
            }

            var championedGames = new List<Champion>
            {
                new Champion { GameDefinition = gameDefinition1, GameDefinitionId = gameDefinitionIdThatIsChampionedByCurrentPlayer },
                new Champion { GameDefinition = gameDefinitionThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer, GameDefinitionId = gameDefinitionIdThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer }
            };
            playerDetails.ChampionedGames = championedGames;

            var formerChampionedGames = new List<GameDefinition>
            {
                gameDefinitionThatIsFormerlyChampionedByCurrentPlayer,
                gameDefinitionThatIsBothCurrentlyAndFormerlyChampionedByCurrentPlayer
            };
            playerDetails.FormerChampionedGames = formerChampionedGames;

          

            builder = new PlayerDetailsViewModelBuilder(gameResultViewModelBuilder, minionViewModelBuilderMock, mapperFactory);

            playerDetailsViewModel = builder.Build(playerDetails, twitterMinionBraggingUrl, currentUser);
        }
Exemplo n.º 20
0
        public void ItPutsThePlayerEditViewModelOnTheView()
        {
            PlayerDetails playerDetails = new PlayerDetails()
            {
                PlayerGameSummaries = new List<PlayerGameSummary>() 
            };
            autoMocker.Get<IPlayerRetriever>().Expect(mock => mock.GetPlayerDetails(playerDetails.Id, 0))
                .Repeat.Once()
                .Return(playerDetails);

            ViewResult result = autoMocker.ClassUnderTest.Edit(playerDetails.Id) as ViewResult;

            var actualViewModel = (PlayerEditViewModel)result.Model;

            Assert.That(playerDetails.Name, Is.EqualTo(actualViewModel.Name));
            Assert.That(playerDetails.Id, Is.EqualTo(actualViewModel.Id));
            Assert.That(playerDetails.GamingGroupId, Is.EqualTo(actualViewModel.GamingGroupId));
            Assert.That(playerDetails.Active, Is.EqualTo(actualViewModel.Active));
            Assert.IsTrue(actualViewModel.IsDeleteable);

        }
Exemplo n.º 21
0
        public void ItPutsTheRecentGamesMessageOnTheViewbag()
        {
            PlayerDetails playerDetails = new PlayerDetails(){ PlayerGameResults = new List<PlayerGameResult>() };
            autoMocker.Get<IPlayerRetriever>().Expect(playerLogic => playerLogic.GetPlayerDetails(
                playerId, 
                PlayerController.NUMBER_OF_RECENT_GAMES_TO_RETRIEVE))
                .Repeat.Once()
                .Return(playerDetails);

            PlayerDetailsViewModel playerDetailsViewModel = new PlayerDetailsViewModel()
            {
                PlayerId = playerId,
                PlayerGameResultDetails = new List<GameResultViewModel>()
            };
            autoMocker.Get<IPlayerDetailsViewModelBuilder>().Expect(viewModelBuilder => viewModelBuilder.Build(playerDetails, expectedMinionUrl, currentUser))
                .Repeat
                .Once()
                .Return(playerDetailsViewModel);
            string expectedMessage = "expected message";
            autoMocker.Get<IShowingXResultsMessageBuilder>().Expect(mock => mock.BuildMessage(
                PlayerController.NUMBER_OF_RECENT_GAMES_TO_RETRIEVE,
                playerDetailsViewModel.PlayerGameResultDetails.Count))
                    .Return(expectedMessage);

            autoMocker.ClassUnderTest.Details(playerId, currentUser);

            Assert.AreEqual(expectedMessage, autoMocker.ClassUnderTest.ViewBag.RecentGamesMessage);
        }
        private static void PopulatePlayerVersusPlayersViewModel(PlayerDetails playerDetails, PlayerDetailsViewModel playerDetailsViewModel)
        {
            var playerVersusPlayers = new PlayersSummaryViewModel
            {
                WinLossHeader = "Win - Loss Record vs. Player"
            };

            foreach (var playerVersusPlayerStatistics in playerDetails.PlayerVersusPlayersStatistics)
            {
                var winPercentage = GetWinPercentage(playerVersusPlayerStatistics);

                var playerSummaryViewModel = new PlayerSummaryViewModel
                {
                    PlayerName = PlayerNameBuilder.BuildPlayerName(playerVersusPlayerStatistics.OpposingPlayerName, playerVersusPlayerStatistics.OpposingPlayerActive),
                    PlayerId = playerVersusPlayerStatistics.OpposingPlayerId,
                    GamesWon = playerVersusPlayerStatistics.NumberOfGamesWonVersusThisPlayer,
                    GamesLost = playerVersusPlayerStatistics.NumberOfGamesLostVersusThisPlayer,
                    WinPercentage = (int)winPercentage
                };

                if (playerDetails.CurrentNemesis != null
                    && playerDetails.CurrentNemesis.NemesisPlayerId == playerVersusPlayerStatistics.OpposingPlayerId)
                {
                    playerSummaryViewModel.SpecialBadgeTypes.Add(new NemesisBadgeViewModel());
                }

                if (playerDetails.PreviousNemesis?.NemesisPlayerId == playerVersusPlayerStatistics.OpposingPlayerId)
                {
                    playerSummaryViewModel.SpecialBadgeTypes.Add(new PreviousNemesisBadgeViewModel());
                }

                if (playerDetails.Minions.Any(x => x.Id == playerVersusPlayerStatistics.OpposingPlayerId))
                {
                    playerSummaryViewModel.SpecialBadgeTypes.Add(new MinionBadgeViewModel());
                }

                playerVersusPlayers.PlayerSummaries.Add(playerSummaryViewModel);
            }

            playerDetailsViewModel.PlayerVersusPlayers = playerVersusPlayers;
        }
 private static void ValidateMinions(PlayerDetails playerDetails)
 {
     if (playerDetails.Minions == null)
     {
         throw new ArgumentException(EXCEPTION_MINIONS_CANNOT_BE_NULL);
     }
 }
 private static void SetAveragePointsPerGame(PlayerDetails playerDetails, PlayerDetailsViewModel playerDetailsViewModel)
 {
     if (playerDetails.PlayerStats.TotalGames == 0)
     {
         playerDetailsViewModel.AveragePointsPerGame = 0;
     }
     else
     {
         playerDetailsViewModel.AveragePointsPerGame = (float)playerDetails.PlayerStats.NemePointsSummary.TotalPoints / (float)playerDetails.PlayerStats.TotalGames;
     }
 }
 private static void ValidateFormerChampionedGames(PlayerDetails playerDetails)
 {
     if (playerDetails.FormerChampionedGames == null)
     {
         throw new ArgumentException(EXCEPTION_FORMERCHAMPIONED_GAMES_CANNOT_BE_NULL);
     }
 }
Exemplo n.º 26
0
        public virtual PlayerDetails GetPlayerDetails(int playerId, int numberOfRecentGamesToRetrieve)
        {
            var returnPlayer = dataContext.GetQueryable<Player>()
                                             .Include(player => player.Nemesis)
                                             .Include(player => player.Nemesis.NemesisPlayer)
                                             .Include(player => player.PreviousNemesis)
                                             .Include(player => player.PreviousNemesis.NemesisPlayer)
                                             .Include(player => player.GamingGroup)
                                             .Include(player => player.PlayerAchievements)
                                             .SingleOrDefault(player => player.Id == playerId);

            ValidatePlayerWasFound(playerId, returnPlayer);

            var playerStatistics = GetPlayerStatistics(playerId);

            var playerGameResults = GetPlayerGameResultsWithPlayedGameAndGameDefinition(playerId, numberOfRecentGamesToRetrieve);

            var minions = GetMinions(returnPlayer.Id);

            var playerGameSummaries = playerRepository.GetPlayerGameSummaries(playerId);

            var championedGames = GetChampionedGames(returnPlayer.Id);

            var formerChampionedGames = GetFormerChampionedGames(returnPlayer.Id);

            var longestWinningStreak = playerRepository.GetLongestWinningStreak(playerId);

            var playerDetails = new PlayerDetails()
            {
                Active = returnPlayer.Active,
                ApplicationUserId = returnPlayer.ApplicationUserId,
                Id = returnPlayer.Id,
                Name = returnPlayer.Name,
                GamingGroupId = returnPlayer.GamingGroupId,
                GamingGroupName = returnPlayer.GamingGroup.Name,
                PlayerGameResults = playerGameResults,
                PlayerStats = playerStatistics,
                CurrentNemesis = returnPlayer.Nemesis ?? new NullNemesis(),
                PreviousNemesis = returnPlayer.PreviousNemesis ?? new NullNemesis(),
                Minions = minions,
                PlayerGameSummaries = playerGameSummaries,
                ChampionedGames = championedGames,
                PlayerVersusPlayersStatistics = playerRepository.GetPlayerVersusPlayersStatistics(playerId),
                FormerChampionedGames = formerChampionedGames,
                LongestWinningStreak = longestWinningStreak,
                NemePointsSummary = playerStatistics.NemePointsSummary,
                Achievements = returnPlayer.PlayerAchievements?.ToList() ?? new List<PlayerAchievement>()
            };

            return playerDetails;
        }