public void ESPNTeamTest()
 {
     using (var test = new ESPNTeam())
     {
         Logger.Configure();
         Player[]      players = test.GetPlayers();
         Roster        roster  = new Roster(players);
         int           count   = players.Length;
         RosterManager manager = new RosterManager(roster, test);
         manager.ManageTeam(4);
     }
 }
Example #2
0
        public static void Main(string[] args)
        {
            Logger.Configure();
            DateTime firstSeptember = new DateTime(DateTime.Today.Year, 9, 1, 7, 0, 0, DateTimeKind.Utc);
            int      dayOffset      = (DayOfWeek.Thursday - firstSeptember.DayOfWeek + 7) % 7 - (DayOfWeek.Thursday - DayOfWeek.Tuesday);
            DateTime startDay       = firstSeptember.AddDays(dayOffset);
            int      currWeek       = (int)((DateTime.Now - startDay).TotalDays / 7 + 1);

            logger.Info("ESPN session starting for week " + currWeek);
            using (var espnTeam = new ESPNTeam())
            {
                Player[]      players = espnTeam.GetPlayers();
                Roster        roster  = new Roster(players);
                int           count   = players.Length;
                RosterManager manager = new RosterManager(roster, espnTeam);
                manager.ManageTeam(currWeek);
            }
            logger.Info("ESPN session for week " + currWeek + " was successful");
        }
Example #3
0
        public void TestManageTeam()
        {
            SetPlayers();
            SetFreeAgents();
            int currWeek = 17;

            players[0].eligibility = Eligibility.Out;
            players[1].eligibility = Eligibility.Injured;
            players[5].byeWeek     = currWeek;
            Player kyle   = players[10];
            Player george = players[6];
            Player quinn  = freeAgents[0];

            var roster   = new Roster(players);
            var espnTeam = new ESPNTeamTest(roster, freeAgents);
            var manager  = new RosterManager(roster, espnTeam);

            manager.ManageTeam(currWeek);

            Assert.AreEqual(manager.Roster.starters[0], kyle);
            Assert.AreEqual(manager.Roster.starters[5], george);
            Assert.AreEqual(manager.Roster.starters[1], quinn);
        }