public override void FixtureSetUp()
        {
            base.FixtureSetUp();
            var dataContext = GetInstance <IDataContext>();

            //--detach these because the Champion data could be out of sync
            dataContext.DetachEntities <Player>();
            _playerRetriever = GetInstance <PlayerRetriever>();
            _player1Details  = _playerRetriever.GetPlayerDetails(testPlayer1.Id, 0);
            _player5Details  = _playerRetriever.GetPlayerDetails(testPlayer5.Id, 0);
        }
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        public virtual ActionResult Details(int id, ApplicationUser currentUser)
        {
            var player = playerRetriever.GetPlayerDetails(id, NUMBER_OF_RECENT_GAMES_TO_RETRIEVE);

            var fullUrl = Url.Action(MVC.Player.ActionNames.Details, MVC.Player.Name, new { id }, Request.Url.Scheme) + "#minions";
            var playerDetailsViewModel = playerDetailsViewModelBuilder.Build(player, fullUrl, currentUser);

            ViewBag.RecentGamesMessage = showingXResultsMessageBuilder.BuildMessage(
                NUMBER_OF_RECENT_GAMES_TO_RETRIEVE,
                player.PlayerGameResults.Count);

            return(View(MVC.Player.Views.Details, playerDetailsViewModel));
        }
        public void ANemesisMustBeActive()
        {
            //player 5 is inactive but beat player 1 three times
            PlayerDetails player1Details = _playerRetriever.GetPlayerDetails(testPlayer1.Id, 0);

            Assert.AreNotEqual(testPlayer5.Id, player1Details.CurrentNemesis.NemesisPlayerId);
        }
Exemple #6
0
        public virtual ActionResult Details(int id, ApplicationUser currentUser)
        {
            var player = playerRetriever.GetPlayerDetails(id, NUMBER_OF_RECENT_GAMES_TO_RETRIEVE);

            var fullUrl = Url.Action(MVC.Player.ActionNames.Details, MVC.Player.Name, new { id }, Request.Url.Scheme) + "#minions";

            var playerIds = player.PlayerVersusPlayersStatistics.Select(x => x.OpposingPlayerId).ToList();

            //--include the current player so we can attempt to get their email address as well
            playerIds.Add(id);
            var playerIdToRegisteredUserEmailAddressDictionary =
                playerRetriever.GetRegisteredUserEmailAddresses(playerIds, currentUser);
            var playerDetailsViewModel = playerDetailsViewModelBuilder.Build(player, playerIdToRegisteredUserEmailAddressDictionary, fullUrl, currentUser);

            ViewBag.RecentGamesMessage = showingXResultsMessageBuilder.BuildMessage(
                NUMBER_OF_RECENT_GAMES_TO_RETRIEVE,
                player.PlayerGameResults.Count);

            return(View(MVC.Player.Views.Details, playerDetailsViewModel));
        }
Exemple #7
0
        public virtual ActionResult Details(int?id, ApplicationUser currentUser)
        {
            if (!id.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            PlayerDetails player = playerRetriever.GetPlayerDetails(id.Value, NUMBER_OF_RECENT_GAMES_TO_RETRIEVE);

            if (player == null)
            {
                return(new HttpNotFoundResult());
            }

            var fullUrl = this.Url.Action(MVC.Player.ActionNames.Details, MVC.Player.Name, new { id }, this.Request.Url.Scheme) + "#minions";
            PlayerDetailsViewModel playerDetailsViewModel = playerDetailsViewModelBuilder.Build(player, fullUrl, currentUser);

            ViewBag.RecentGamesMessage = showingXResultsMessageBuilder.BuildMessage(
                NUMBER_OF_RECENT_GAMES_TO_RETRIEVE,
                player.PlayerGameResults.Count);

            return(View(MVC.Player.Views.Details, playerDetailsViewModel));
        }