public FantasyProjectionReporter(  IKeepTheTime timekeeper)
        {
            Name = "Fantasy Point Projections";
             TimeKeeper = timekeeper;
             var dao = new DbfPlayerGameMetricsDao();
             var scorer = new YahooProjectionScorer();
             var theWeek = TimeKeeper.CurrentWeek( DateTime.Now );
             if (theWeek.Equals( 0 )) theWeek = 1;

             Configs = new List<FantasyProjectionReportConfig>
             {
            new FantasyProjectionReportConfig
            {
               Season = TimeKeeper.CurrentSeason( DateTime.Now ),
               Week = theWeek.ToString( CultureInfo.InvariantCulture ),
               Dao = dao,
               Scorer = scorer
            }
             };

             Leagues = new List<RosterGridLeague>();
             //Leagues.Add(new RosterGridLeague {
             //   Id = Constants.K_LEAGUE_Gridstats_NFL1, Name = "Gridstats GS1"
             //});
             Leagues.Add( new RosterGridLeague
             {
            Id = Constants.K_LEAGUE_Yahoo,
            Name = "Spitzys"
             } );
             //Leagues.Add( new RosterGridLeague
             //{
             //   Id = Constants.K_LEAGUE_Rants_n_Raves,
             //   Name = "NFL.com"
             //} );
        }
예제 #2
0
 public FpProjections()
 {
     Name = "FP Projections";
      Fpr = new FantasyProjectionReport();
      Dao = new DbfPlayerGameMetricsDao();  //  for fetching the metrics (but they need generation)
      Scorer = new YahooProjectionScorer();
      Configure();
 }
 public void TestRenderRantsProjection()
 {
     var dao = new DbfPlayerGameMetricsDao();  //  Could use a Fake here
      var scorer = new YahooProjectionScorer();  //  Could use a Fake here
      var sut = new FantasyProjectionReport("2013", "2", dao, scorer) {League = Constants.K_LEAGUE_Rants_n_Raves};
      sut.RenderAll();
      var fileOut = sut.FileName();
      Assert.IsTrue(File.Exists(fileOut));
 }
 public void TestFileGetsOutputForSF()
 {
     //  small focused test on specific criteria
      var dao = new DbfPlayerGameMetricsDao();  //  Could use a Fake here
      var scorer = new YahooProjectionScorer();  //  Could use a Fake here
      var sut = new FantasyProjectionReport( "2014", "01", dao, scorer ) {TeamFilter = "SF", CategoryFilter = "3"};
      sut.Render();
      var fileOut = sut.FileName();
      Assert.IsTrue(File.Exists(fileOut));
 }
 public void TestRenderAllFantasyProjections()
 {
     //  test a league using yahoo scoring - takes a fair while
      //  out put goes here g:\FileSync\SyncProjects\GerardGui\Gerard.Tests\bin\Debug\Output\2014\Projections\
      var dao = new DbfPlayerGameMetricsDao();  //  Could use a Fake here
      var scorer = new YahooProjectionScorer();  //  Could use a Fake here
      var sut = new FantasyProjectionReport( "2015", "04", dao, scorer ) {League = Constants.K_LEAGUE_Yahoo};
      sut.RenderAll();
      var fileOut = sut.FileName();
      Assert.IsTrue( File.Exists(fileOut ) );
 }
 public void TestFileGetsOutputForWR()
 {
     var dao = new DbfPlayerGameMetricsDao();  //  Could use a Fake here
      var scorer = new YahooProjectionScorer();  //  Could use a Fake here
      var sut = new FantasyProjectionReport( "2014", "1", dao, scorer )
     {
        League = Constants.K_LEAGUE_Gridstats_NFL1,
        CategoryFilter = "3"
     };
      sut.Render();
      var fileOut = sut.FileName();
      Assert.IsTrue(File.Exists(fileOut));
 }
예제 #7
0
        public decimal CalculateActualFantasyPoints(NFLPlayer p)
        {
            var scorer = new YahooProjectionScorer();

            p.ProjectedTDp = TDp;
            p.ProjectedYDp = YDp;
            p.ProjectedYDr = YDr;
            p.ProjectedTDr = TDr;
            p.ProjectedYDc = YDc;
            p.ProjectedTDc = TDc;
            p.ProjectedFg  = FG;
            p.ProjectedPat = Pat;

            var pts = scorer.RatePlayer(p, new NFLWeek(Season(), 99, loadGames: false));

            return(pts);
        }
        public FantasyProjectionReporter(IKeepTheTime timekeeper) : base(timekeeper)
        {
            Name       = "Fantasy Point Projections";
            TimeKeeper = timekeeper;
            var dao     = new DbfPlayerGameMetricsDao();
            var scorer  = new YahooProjectionScorer();
            var theWeek = TimeKeeper.CurrentWeek(DateTime.Now);

            if (theWeek.Equals(0))
            {
                theWeek = 1;
            }

            Configs = new List <FantasyProjectionReportConfig>
            {
                new FantasyProjectionReportConfig
                {
                    Season = TimeKeeper.CurrentSeason(DateTime.Now),
                    Week   = theWeek.ToString(CultureInfo.InvariantCulture),
                    Dao    = dao,
                    Scorer = scorer
                }
            };

            Leagues = new List <RosterGridLeague>();
            //Leagues.Add(new RosterGridLeague {
            //   Id = Constants.K_LEAGUE_Gridstats_NFL1, Name = "Gridstats GS1"
            //});
            Leagues.Add(new RosterGridLeague
            {
                Id   = Constants.K_LEAGUE_Yahoo,
                Name = "Spitzys"
            });
            //Leagues.Add( new RosterGridLeague
            //{
            //   Id = Constants.K_LEAGUE_Rants_n_Raves,
            //   Name = "NFL.com"
            //} );
        }
예제 #9
0
        private string PlayerProjectionsHtml(NflTeam nflTeam)
        {
            var html = HtmlLib.H4(nflTeam.NameOut()) + Environment.NewLine;
             html += HtmlLib.TableWithBorderOpen();
             if (nflTeam.PlayerList.Count == 0) nflTeam.LoadPlayerUnits();
             if (PgmDao == null) PgmDao = new DbfPlayerGameMetricsDao();
             if (GameWeek == null) GameWeek = new NFLWeek( Season, Week );
             var scorer = new YahooProjectionScorer();
             var nPlayers = 0;
             var nTotPts = 0.0M;
             var totPgm = new PlayerGameMetrics();
             foreach (NFLPlayer p in nflTeam.PlayerList)
             {
            if (!p.IsFantasyOffence()) continue;

            nPlayers++;
            var pgm = PgmDao.Get(p.PlayerCode, GameKey());
            if (nPlayers == 1) html += pgm.PgmHeaderRow();
            if (!pgm.HasNumbers()) continue;
            SetProjectedStats( p, pgm );
            var fpts = scorer.RatePlayer( p, GameWeek );
            nTotPts += fpts;
            html += HtmlLib.Para(pgm.FormatAsTableRow(p.PlayerName, p.PlayerRole, fpts)) + Environment.NewLine;
            totPgm.ProjYDp += pgm.ProjYDp;
            totPgm.ProjTDp += pgm.ProjTDp;
            totPgm.ProjYDr += pgm.ProjYDr;
            totPgm.ProjTDr += pgm.ProjTDr;
            totPgm.ProjYDc += pgm.ProjYDc;
            totPgm.ProjTDc += pgm.ProjTDc;
            totPgm.ProjFG += pgm.ProjFG;
            totPgm.ProjPat += pgm.ProjPat;
             }
             html += HtmlLib.Para(totPgm.FormatAsTableRow("Totals", "", nTotPts)) + Environment.NewLine;
             html += HtmlLib.TableClose();
             return html;
        }
예제 #10
0
        public decimal CalculateProjectedFantasyPoints( NFLPlayer p )
        {
            var scorer = new YahooProjectionScorer();
             p.ProjectedTDp = ProjTDp;
             p.ProjectedYDp = ProjYDp;
             p.ProjectedYDr = ProjYDr;
             p.ProjectedTDr = ProjTDr;
             p.ProjectedYDc = ProjYDc;
             p.ProjectedTDc = ProjTDc;
             p.ProjectedFg = ProjFG;
             p.ProjectedPat = ProjPat;

             var pts = scorer.RatePlayer( p, new NFLWeek( Season(), 99, loadGames: false ) );
             return pts;
        }
 public void TestRenderSingleLeagueRunningbacksProjection()
 {
     //  shorter test 7 mins just on running backs
      var dao = new DbfPlayerGameMetricsDao();  //  Could use a Fake here
      var scorer = new YahooProjectionScorer();  //  Could use a Fake here
      var sut = new FantasyProjectionReport("2014", "14", dao, scorer) {
     League = Constants.K_LEAGUE_Yahoo};
      sut.RenderRunningbacks();
      var fileOut = sut.FileName();
      Assert.IsTrue(File.Exists(fileOut));
 }
 public void TestScoringOnARunningBack()
 {
     var sut = new YahooProjectionScorer();
      var w = new NFLWeek( "2014", "14" );
      var p = new NFLPlayer( "BERNGI01" );
      var gameKey = p.GameKeyFor( "2014", "14" );
      // plyr needs their projections loaded too
      var dao = new DbfPlayerGameMetricsDao();  //  Could use a Fake here
      var pgm = dao.GetPlayerWeek( gameKey, p.PlayerCode );
      p.LoadProjections( pgm );
      var score = sut.RatePlayer( p, w );
      Assert.AreEqual( 12.0M, score );
 }
 public void TestRenderTommysProjection()
 {
     var dao = new DbfPlayerGameMetricsDao();  //  Could use a Fake here
      var scorer = new YahooProjectionScorer();  //  Could use a Fake here
      var sut = new FantasyProjectionReport("2013", "4", dao, scorer)
     {
        League = Constants.K_LEAGUE_50_Dollar_Challenge
     };
      sut.RenderAll();
      Assert.IsTrue(File.Exists(sut.FileName()));
 }