Ejemplo n.º 1
0
        public void Detector_ShowsAllFreeAgentWithStats()
        {
            var retroFreeAgentService = new RetroFreeAgentService(
                new GameLogService.GameLogService(),
                K_CurrentSeason,
                new int[] { 1, 4, 6, 9, 12, 13, 16 });

            var result = retroFreeAgentService
                         .ShowAllFreeAgents(9, true);

            Assert.IsTrue(result > 0);
        }
Ejemplo n.º 2
0
        public int ShowAllFreeAgentsWithTeam(
            string fantasyTeamCode,
            int weekNo,
            bool skipZeros = false)
        {
            // get the roster of the fantasy team
            var roster = GetRoster(fantasyTeamCode);
            //  convert roster to players
            var rosterPlayers = new List <GameLogService.Model.Player>();

            foreach (var item in roster)
            {
                var playerId  = ParseIdOf(item);
                var player    = GetPlayer(playerId.ToString());
                var glsPlayer = new GameLogService.Model.Player
                {
                    Id           = playerId,
                    Name         = player.Name,
                    Team         = player.NflTeamCode,
                    GridstatsPos = player.Position,
                    Category     = "ROSTERED"
                };
                rosterPlayers.Add(glsPlayer);
            }
            var valuedPlayers = _freeAgentService.GetFreeAgentsWithStarRating(
                weekNo,
                skipZeros,
                rosterPlayers);
            var freeAgents = _freeAgentService.GetFreeAgentsWithStarRating(
                weekNo,
                skipZeros);
            var combinedList = new List <GameLogService.Model.Player>();

            combinedList.AddRange(valuedPlayers);
            combinedList.AddRange(freeAgents);
            var sortedCombinedList = combinedList.OrderByDescending(
                p => p.Stars).ToList();

            return(_freeAgentService.ShowAllFreeAgents(
                       weekNo,
                       false,
                       sortedCombinedList));
        }