Ejemplo n.º 1
0
        private static string WeeklyEspnPerformance(
            string catCode, int week, string leagueId, [System.Runtime.InteropServices.Optional] string sPos)
        {
            var pl = new PlayerLister {
                WeeksToGoBack = 1
            };
            var master      = new YahooMaster("Yahoo", "YahooOutput.xml");
            var currentWeek =
                new NFLWeek(Int32.Parse(Utility.CurrentSeason()), weekIn: week, loadGames: false);
            var gs = new EspnScorer(currentWeek)
            {
                Master = master
            };

            pl.SetScorer(gs);
            pl.SetFormat("weekly");
            pl.AllWeeks    = false;          //  just the regular saeason
            pl.Season      = currentWeek.Season;
            pl.RenderToCsv = false;
            pl.Week        = week;
            pl.Collect(catCode, sPos: sPos, fantasyLeague: leagueId);

            var targetFile = string.Format("{4}{3}//Performance//{2}-Yahoo {1} Performance upto Week {0}.htm",
                                           currentWeek.WeekNo, sPos, leagueId, pl.Season, Utility.OutputDirectory());

            pl.Render(targetFile);
            return(pl.FileOut);
        }
Ejemplo n.º 2
0
        public void TestEspnScorer()
        {
            var week = new NFLWeek(seasonIn: 2013, weekIn: 3, loadGames: false);
            var gs   = new EspnScorer(week)
            {
                Master = new YahooMaster("Yahoo", "YahooOutput.xml")
            };
            var player = new NFLPlayer("VICKMI01");
            var pts    = gs.RatePlayer(player, week);

            Assert.AreEqual(11, pts, "Vick got 11 pts in week 3 of 2013");
        }
Ejemplo n.º 3
0
        public void TestEspnPerformanceReportRunningBacksWeek5()
        {
            var pr   = new PerformanceReport(season: "2012", week: 5);
            var week = new NFLWeek(seasonIn: 2012, weekIn: 5, loadGames: false);
            var gs   = new EspnScorer(week)
            {
                ScoresOnly = true
            };

            pr.Scorer = gs;
            pr.Render(catCode: "2", sPos: "RB", leagueId: Constants.K_LEAGUE_Yahoo, startersOnly: true);
            Assert.IsTrue(File.Exists(pr.FileOut), string.Format("Cannot find {0}", pr.FileOut));
        }
Ejemplo n.º 4
0
        private static void DoRantsReport(PlayerLister pl, NFLWeek theWeek, EspnScorer gs, string leagueId, string rptPos, string cat)
        {
            pl.SetScorer(gs);
            pl.StartersOnly = true;          // more thorough to do false
            pl.SetFormat("weekly");          //  as opposed to "annual" totals
            pl.AllWeeks = false;             //  just the regular season
            pl.Season   = theWeek.Season;
            pl.Collect(catCode: cat, sPos: rptPos, fantasyLeague: leagueId);
            var targetFile = string.Format("{2}{0}//Performance//{3}-Yahoo {1} Performance {0}.htm", pl.Season, rptPos, Utility.OutputDirectory(), leagueId);

            pl.Render(targetFile);
            Assert.IsTrue(File.Exists(pl.FileOut), string.Format("Cannot find {0}", pl.FileOut));
        }
Ejemplo n.º 5
0
        public void TestRantsPerformanceUptoCurrent()
        {
            var pl      = new PlayerLister();
            var theWeek = new NFLWeek(seasonIn: 2013, weekIn: System.Int32.Parse(Utility.CurrentWeek()), loadGames: false);
            var gs      = new EspnScorer(theWeek);

            var leagueId = Constants.K_LEAGUE_Rants_n_Raves;

            DoRantsReport(pl, theWeek, gs, leagueId, "QB", Constants.K_QUARTERBACK_CAT);
            DoRantsReport(pl, theWeek, gs, leagueId, "RB", Constants.K_RUNNINGBACK_CAT);
            DoRantsReport(pl, theWeek, gs, leagueId, "WR", Constants.K_RECEIVER_CAT);
            DoRantsReport(pl, theWeek, gs, leagueId, "TE", Constants.K_RECEIVER_CAT);
            DoRantsReport(pl, theWeek, gs, leagueId, "PK", Constants.K_KICKER_CAT);
        }
Ejemplo n.º 6
0
        public void TestYahooPerformanceUptoCurrent()
        {
            var pl       = new PlayerLister();
            var theWeek  = new NFLWeek(seasonIn: 2013, weekIn: System.Int32.Parse(Utility.CurrentWeek()), loadGames: false);
            var gs       = new EspnScorer(theWeek);
            var leagueId = Constants.K_LEAGUE_Yahoo;
            var rptPos   = "RB";

            pl.SetScorer(gs);
            pl.StartersOnly = true;          // more thorough to do false
            pl.SetFormat("weekly");          //  as opposed to "annual" totals
            pl.AllWeeks = false;             //  just the regular season
            pl.Season   = theWeek.Season;
            pl.Collect(catCode: Constants.K_RUNNINGBACK_CAT, sPos: rptPos, fantasyLeague: leagueId);
            var targetFile = string.Format("{2}{0}//Performance//Yahoo {1} Performance {0}-{3}.htm", pl.Season, rptPos, Utility.OutputDirectory(), leagueId);

            pl.Render(targetFile);
            Assert.IsTrue(File.Exists(pl.FileOut), string.Format("Cannot find {0}", pl.FileOut));
        }