Пример #1
0
 /// <summary>
 /// Returns the array of players from espn.com
 /// </summary>
 /// <returns></returns>
 public Player[] GetPlayers()
 {
     if (roster == null)
     {
         ReadRoster();
     }
     return(roster.GetPlayers());
 }
Пример #2
0
 public Player[] GetPlayers()
 {
     return((from p in roster.GetPlayers() select new Player()
     {
         byeWeek = p.byeWeek,
         eligibility = p.eligibility,
         position = p.position,
         name = p.name,
         projected = p.projected,
         team = p.team
     }).ToArray());
 }
Пример #3
0
        /// <summary>
        /// Reads the roster from espn.com
        /// </summary>
        private void ReadRoster()
        {
            if (url != ROSTER_URL)
            {
                logger.Trace("Going to roster page");
                url        = ROSTER_URL;
                driver.Url = url;
            }
            if (!isLoggedIn)
            {
                LogIn();
            }

            logger.Trace("Reading the roster");
            Player[] players = new Player[16];
            var      table   = navigator.GetTable();

            foreach (var row in table.FindElements(By.XPath("./tr")))
            {
                Int32.TryParse(row.GetAttribute("data-idx"), out int idx);
                if (idx == 9)
                {
                    continue;
                }
                if (idx > 9)
                {
                    idx--;
                }
                players[idx] = navigator.ReadPlayerRow(row, PlayerTable.Roster);
            }
            roster = new Roster(players);

            //for logging purposes only
            StringBuilder rosterString = new StringBuilder("Roster read:");

            foreach (Player p in roster.GetPlayers())
            {
                rosterString.Append("\n");
                rosterString.Append(p);
            }
            logger.Info(rosterString.ToString());
        }
Пример #4
0
 public Roster(Roster roster) : this(roster.GetPlayers())
 {
 }
Пример #5
0
 public ESPNTeamTest(Roster roster, Player[] freeAgents)
 {
     Player[] players = roster.GetPlayers();
     this.roster     = new Roster(players);
     this.freeAgents = freeAgents;
 }