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 void TestRosterSub(int startID, bool success)
        {
            SetPlayers();
            SetFreeAgents();
            players[9].position = Position.WideReceiver;
            var       roster   = new Roster(players);
            IESPNTeam espnTeam = new ESPNTeamTest(roster, freeAgents);
            var       manager  = new RosterManager(roster, espnTeam);

            Player starter = roster.starters[startID];
            Player newGuy  = manager.GetSub(startID, 2); //sub out starter 0

            Assert.IsTrue(newGuy.IsNull() ^ success);
        }
Example #3
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 #4
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);
        }