public void SpreadTipsSpreadPredictionTest() { // Arrange var sut = new NFLGame("2012:01-A"); // YYYY:0W-X // Act sut.CalculateSpreadResult(); // Assert Assert.AreEqual(23, sut.BookieTip.HomeScore); Assert.AreEqual(20, sut.BookieTip.AwayScore); }
private DataTable BuildTable() { var dt = new DataTable(); var cols = dt.Columns; cols.Add("SLOT", typeof(String)); cols.Add("PLAYER", typeof(String)); cols.Add("TEAM", typeof(String)); cols.Add("FTEAM", typeof(String)); cols.Add("POS", typeof(String)); cols.Add("PTS", typeof(Int16)); cols.Add("UNIT", typeof(String)); cols.Add("ROLE", typeof(String)); cols.Add("GAME", typeof(String)); cols.Add("OPPRATE", typeof(String)); cols.Add("SPREAD", typeof(Decimal)); cols.Add("TOTAL", typeof(Decimal)); cols.Add("BOOKIE", typeof(String)); cols.Add("ACTUAL", typeof(Int16)); PgmList = PgmDao.GetWeek(Season, Week); var week = Scorer.Week; foreach (var pgm in PgmList) { var p = new NFLPlayer(pgm.PlayerId); if (!string.IsNullOrEmpty(TeamFilter)) { if (p.TeamCode != TeamFilter) { continue; } } if (!string.IsNullOrEmpty(CategoryFilter)) { if (p.PlayerCat != CategoryFilter) { continue; } } p.LoadOwner(League); var dr = dt.NewRow(); var game = new NFLGame(pgm.GameKey); p.LoadProjections(pgm); var opponent = p.CurrTeam.OpponentFor(Season, Int32.Parse(Week)); // player actually available dr["PLAYER"] = p.Url(p.PlayerName, forceReport: false); dr["TEAM"] = p.CurrTeam.TeamCode; dr["FTEAM"] = p.Owner; dr["ROLE"] = p.PlayerRole; dr["POS"] = p.PlayerPos; dr["PTS"] = Scorer.RatePlayer(p, week); dr["UNIT"] = game.ProjectionLink(); dr["GAME"] = string.Format("{0} {1} {2}", game.GameDay(), game.Hour, game.OpponentOut(p.CurrTeam.TeamCode)); dr["SPREAD"] = game.GetSpread(); dr["TOTAL"] = game.Total; game.CalculateSpreadResult(); dr["BOOKIE"] = game.BookieTip.PredictedScore(); if (opponent != null) { dr["OPPRATE"] = opponent.Ratings; } //if ( game.Played() ) // dr[ "ACTUAL" ] = ActualPoints( p ); dt.Rows.Add(dr); } dt.DefaultView.Sort = "PTS DESC"; return(dt); }