Пример #1
0
        public void RenderTeamToDefendAgainst(NFLWeek week)
        {
            //  Team to beat report showing a jucy opponent for a particular defence
            var offset = -4;

            if (week.WeekNo < 2)
            {
                //  do the whole of last season
#if DEBUG
                Utility.Announce("Looking back at the whole of last season");
#endif
                offset = -Constants.K_WEEKS_IN_REGULAR_SEASON;
            }
            else
            {
#if DEBUG
                Utility.Announce("Going back 4 games");
#endif
            }

            var ttb = new TeamLister
            {
                Heading    = string.Format("{0}\\defense\\Team To beat-{1:0#}", week.Season, week.WeekNo),
                SubHeading = string.Format("last {0} weeks", offset)
            };
            ICalculate ttbCalculator =
                new DefensiveScoringCalculator(new NFLWeek(week.SeasonNo, week.WeekNo), offset);
            FileOut = ttb.RenderTeamToBeat(ttbCalculator);
        }
 public void TestDefensivePatsyBBReport()
 {
     var team = new NflTeam( "BB" );
      var tl = new TeamLister(team) {Heading = "Defence Friendly Offences"};
       ICalculate ttbCalculator = new DefensiveScoringCalculator( new NFLWeek( 2013, 1 ), -17 );
      var fileOut = tl.RenderTeamToBeat( ttbCalculator );
      Assert.IsTrue( File.Exists( fileOut ), string.Format( "Cannot find {0}", fileOut ) );
 }
Пример #3
0
 public void TestDefensiveScoringCalculator()
 {
     var week = new NFLWeek( seasonIn: "2016", weekIn: "13" );
      var team = new NflTeam( "KC" );
      var game = new NFLGame( gameKey: "2016:13-B" );  // KC @ AF
      var sut = new DefensiveScoringCalculator( week, offset:0 );
      sut.Calculate( team: team, game: game );
      Assert.AreEqual( expected: 11.0M, actual: team.FantasyPoints );
 }
 public void TestPatriotsDefenseCalcs()
 {
     var week = new NFLWeek( 2010, 17 );
      ICalculate myCalculator = new DefensiveScoringCalculator( week, -1 );
      var team = new NflTeam( "NE" );
      team.CalculateDefensiveScoring( myCalculator, doOpponent: false );
      Assert.AreEqual( 17, myCalculator.Team.FantasyPoints );
      Assert.AreEqual( 1, myCalculator.Team.TotInterceptions );
      Assert.AreEqual( 5, myCalculator.Team.TotSacks );
 }
Пример #5
0
        public void RenderDefensiveScoringReport(NFLWeek week)
        {
            var offset = -6;

            if (week.WeekNo < 2)
            {
                //  do the whole of last season
                offset = -Constants.K_WEEKS_IN_REGULAR_SEASON;
            }

            var tl = new TeamLister
            {
                Heading    = string.Format("{0}\\defense\\Defensive Scoring-{1:0#}", week.Season, week.WeekNo),
                SubHeading = string.Format("last {0} weeks", offset)
            };
            ICalculate myCalculator = new DefensiveScoringCalculator(week, offset);

            FileOut = tl.RenderTeams(myCalculator);
        }
Пример #6
0
        public decimal DefensiveFantasyPtsFor( string teamCode )
        {
            if ( !Played() ) return 0.0M;

             NflTeam team;
             if ( IsAway( teamCode ) )
            team = AwayNflTeam;
             else
            team = HomeNflTeam;

             if ( GameWeek == null ) GameWeek = new NFLWeek( Season, Week );
             var calculator = new DefensiveScoringCalculator( GameWeek, offset: 0 );
             calculator.Calculate( team: team, game: this );
             return team.FantasyPoints;
        }