private void SetScores(TeamLeague league, List <Tuple <Tuple <Team, int>, Tuple <Team, int> > > scores)
        {
            int counter = 0;

            while (true)
            {
                foreach (var round in league.Rounds)
                {
                    foreach (var match in round.Matches)
                    {
                        var score = scores[counter];
                        match.MatchEntries.ToList()[0].Team  = score.Item1.Item1;
                        match.MatchEntries.ToList()[0].Score = new IntegerScore {
                            Value = score.Item1.Item2
                        };
                        match.MatchEntries.ToList()[1].Team  = score.Item2.Item1;
                        match.MatchEntries.ToList()[1].Score = new IntegerScore {
                            Value = score.Item2.Item2
                        };
                        counter++;
                        if (counter == scores.Count)
                        {
                            return;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Returns a complete list of PlayerFixtureStats representing an entire team for
        /// a fixture, regardless of whether the player has played in the fixture
        /// </summary>
        /// <param name="existingPlayerFixtures"></param>
        /// <param name="allPlayersInTeam"></param>
        /// <param name="teamLeague"></param>
        /// <param name="fixture"></param>
        /// <returns></returns>
        public List <PlayerFixtureStats> MapToPlayerFixtureStats(List <PlayerFixture> existingPlayerFixtures,
                                                                 List <Player> allPlayersInTeam,
                                                                 TeamLeague teamLeague,
                                                                 Fixture fixture)
        {
            List <PlayerFixtureStats> playerFixturesScreen = new List <PlayerFixtureStats>();
            PlayerFixture             existingPlayerFixture;


            foreach (Player player in allPlayersInTeam)
            {
                // Select PF record if exists
                existingPlayerFixture = existingPlayerFixtures.Where(x => x.Player.Id == player.Id).SingleOrDefault();

                // If a PF record exists, add it. If not, add a blank record
                if (existingPlayerFixture != null)
                {
                    playerFixturesScreen.Add(new PlayerFixtureStats(existingPlayerFixture, true));
                }
                else
                {
                    playerFixturesScreen.Add(new PlayerFixtureStats(new PlayerFixture(teamLeague, fixture, player, 0, 0), false));
                }
            }

            return(playerFixturesScreen);
        }
        public void HomeAndAwayWins_TwoHomeWinsOneAwayWin_ReturnsTwoHomeWinsAndOneAwayWin()
        {
            var teamLeagueA = new TeamLeague()
            {
                Id = 1
            };
            var teamLeagueB = new TeamLeague()
            {
                Id = 2
            };
            var teamLeagueC = new TeamLeague()
            {
                Id = 3
            };
            var fixtures = new List <Fixture>();

            fixtures.Add(GetFixture(teamLeagueA, teamLeagueB, true));  // A home win
            fixtures.Add(GetFixture(teamLeagueA, teamLeagueB, true));  // A home win
            fixtures.Add(GetFixture(teamLeagueB, teamLeagueA, false)); // A away win
            fixtures.Add(GetFixture(teamLeagueB, teamLeagueA, true));  // B win
            fixtures.Add(GetFixture(teamLeagueB, teamLeagueC, true));

            Assert.That(teamLeagueA.GetHomeWins(fixtures), Is.EqualTo(2));
            Assert.That(teamLeagueA.GetAwayWins(fixtures), Is.EqualTo(1));
            Assert.That(teamLeagueA.GetTotalWins(fixtures), Is.EqualTo(3));
        }
        private TeamLeague AddTeamLeague(int id, Team team, League league, out TeamLeague teamLeague)
        {
            teamLeague    = new TeamLeague(league, team, team.TeamName, team.TeamNameLong);
            teamLeague.Id = id;

            return(teamLeague);
        }
        public void GetHomeWins_AwayForfeit_ReturnsOne()
        {
            TeamLeague teamLeague = new TeamLeague()
            {
                Id = 1, Team = new Team()
                {
                    Id = 12
                }
            };
            List <Fixture> fixtures       = new List <Fixture>();
            Team           forfeitingTeam = new Team()
            {
                Id = 11
            };

            fixtures.Add(new Fixture()
            {
                IsPlayed       = "Y",
                IsCupFixture   = false,
                Id             = 1,
                HomeTeamLeague = teamLeague,
                AwayTeamLeague = new TeamLeague()
                {
                    Id = 2, Team = forfeitingTeam
                },
                IsForfeit      = true,
                ForfeitingTeam = forfeitingTeam
            });

            Assert.That(teamLeague.GetHomeWins(fixtures), Is.EqualTo(1));
        }
        public void CanCreateTeamLeague()
        {
            string teamName     = "Velocity";
            string teamNameLong = "Nunthorpe Velocity";
            Season season       = new Season(2008, 2009);
            League league       = new League(season, "Mens", 1, 1);
            Team   team         = new Team(teamName, teamNameLong);;

            TeamLeague teamLeague = new TeamLeague(league, team, teamName, teamNameLong);

            Assert.IsNotNull(teamLeague);
            Assert.That(teamLeague.TeamName, Is.EqualTo(teamName));
            Assert.That(teamLeague.TeamNameLong, Is.EqualTo(teamNameLong));
            Assert.That(teamLeague.Team, Is.EqualTo(team));
            Assert.That(teamLeague.League, Is.EqualTo(league));

            // Assert defaults
            Assert.That(teamLeague.GamesLostAway, Is.EqualTo(0));
            Assert.That(teamLeague.GamesLostHome, Is.EqualTo(0));
            Assert.That(teamLeague.GamesLostTotal, Is.EqualTo(0));
            Assert.That(teamLeague.GamesPct, Is.EqualTo(0));
            Assert.That(teamLeague.GamesPlayed, Is.EqualTo(0));
            Assert.That(teamLeague.GamesWonAway, Is.EqualTo(0));
            Assert.That(teamLeague.GamesWonHome, Is.EqualTo(0));
            Assert.That(teamLeague.GamesWonTotal, Is.EqualTo(0));
            Assert.That(teamLeague.PointsAgainstPerGameAvg, Is.EqualTo(0));
            Assert.That(teamLeague.PointsLeague, Is.EqualTo(0));
            Assert.That(teamLeague.PointsScoredAgainst, Is.EqualTo(0));
            Assert.That(teamLeague.PointsScoredDifference, Is.EqualTo(0));
            Assert.That(teamLeague.PointsScoredFor, Is.EqualTo(0));
            Assert.That(teamLeague.PointsScoredPerGameAvg, Is.EqualTo(0));
            Assert.That(teamLeague.Streak, Is.EqualTo(null));
        }
        public void GetHomeLosses_HomeForfeitExcludeForfeits_ReturnsZero()
        {
            Team forfeitingTeam = new Team()
            {
                Id = 11
            };
            TeamLeague teamLeague = new TeamLeague()
            {
                Id = 1, Team = forfeitingTeam
            };
            List <Fixture> fixtures = new List <Fixture>();

            fixtures.Add(new Fixture()
            {
                IsPlayed       = "Y",
                IsCupFixture   = false,
                Id             = 1,
                HomeTeamLeague = new TeamLeague()
                {
                    Id = 2, Team = new Team()
                    {
                        Id = 12
                    }
                },
                AwayTeamLeague = teamLeague,
                IsForfeit      = true,
                ForfeitingTeam = forfeitingTeam
            });

            Assert.That(teamLeague.GetHomeLosses(fixtures, false), Is.EqualTo(0));
        }
Пример #8
0
        public static IList <TeamLeague> CreateTeamLeagueList()
        {
            IList <TeamLeague> list = new List <TeamLeague>();

            League league = new League(new Season(2008, 2009), "Mens", 1, 1);

            EntityIdSetter.SetIdOf(league, 1);
            Team team = new Team("Velocity", "Velocity");

            EntityIdSetter.SetIdOf(team, 1);
            Team team2 = new Team("Heat", "Heat");

            EntityIdSetter.SetIdOf(team2, 2);

            TeamLeague teamLeague = new TeamLeague(league, team, "Velocity", "Velocity");

            EntityIdSetter.SetIdOf(teamLeague, 1);

            TeamLeague teamLeague2 = new TeamLeague(league, team2, "Velocity", "Velocity");

            EntityIdSetter.SetIdOf(teamLeague2, 2);

            list.Add(teamLeague);
            list.Add(teamLeague2);

            return(list);
        }
        public void IsTeamInLeagueShouldReturnTrue()
        {
            var options = new DbContextOptionsBuilder <FooteoDbContext>()
                          .UseInMemoryDatabase(databaseName: "IsTeamInLeagueTrue_Teams_DB")
                          .Options;

            var dbContext = new FooteoDbContext(options);

            var townsService   = new TownsService(dbContext);
            var leaguesService = new LeaguesService(dbContext, townsService);

            var mockUserStore = new Mock <IUserStore <FooteoUser> >();
            var userManager   = new Mock <UserManager <FooteoUser> >(mockUserStore.Object, null, null, null, null, null, null, null, null);

            var town = townsService.CreateTown("Stara Zagora");

            var user = new FooteoUser
            {
                Age          = new Random().Next(20, 30),
                Email        = $"*****@*****.**",
                FirstName    = "Footeo",
                LastName     = "Player",
                UserName     = $"footeoPlayer",
                Town         = town,
                PasswordHash = "123123",
                Player       = new Player
                {
                    FullName = "Footeo Player"
                }
            };

            dbContext.Users.Add(user);
            dbContext.SaveChanges();

            userManager.Setup(u => u.RemoveFromRoleAsync(user, "Player")).Returns(Task.FromResult(IdentityResult.Success));
            userManager.Setup(u => u.AddToRoleAsync(user, "PlayerInTeam")).Returns(Task.FromResult(IdentityResult.Success));
            userManager.Setup(u => u.AddToRoleAsync(user, "Captain")).Returns(Task.FromResult(IdentityResult.Success));

            var teamsService = new TeamsService(dbContext, townsService, leaguesService, userManager.Object, null);

            teamsService.CreateTeam("Team", "TTT", user.UserName);
            var team = dbContext.Teams.FirstOrDefault(n => n.Name == "Team");

            leaguesService.CreateLeague("League", "Desc", DateTime.UtcNow, DateTime.UtcNow.AddMonths(2), "Stara Zagora");
            var league = dbContext.Leagues.FirstOrDefault(n => n.Name == "League");

            var teamLeague = new TeamLeague
            {
                Team   = team,
                League = league
            };

            dbContext.TeamsLeagues.Add(teamLeague);
            dbContext.SaveChanges();

            var isTeamInLeague = teamsService.IsTeamInLeague(team.Id);

            Assert.True(isTeamInLeague);
        }
Пример #10
0
        public ActionResult DeleteConfirmed(int id)
        {
            TeamLeague teamLeague = db.TeamLeagues.Find(id);

            db.TeamLeagues.Remove(teamLeague);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <TeamLeagueDto> Handle(CreateTeamLeagueCommand request, CancellationToken cancellationToken)
        {
            var league = await context.TeamLeagues.SingleOrDefaultAsync(x => x.Name == request.Name, cancellationToken);

            if (league != null)
            {
                throw new CompetitionAlreadyExistsException(request.Name);
            }

            var sports = await context.TeamSports
                         .Include(t => t.Options)
                         .SingleOrDefaultAsync(ts => ts.Name == request.Sports);

            if (sports == null)
            {
                throw new SportsNotFoundException(request.Sports);
            }

            Country country = null;

            if (!string.IsNullOrEmpty(request.Country))
            {
                country = await context.Countries.SingleOrDefaultAsync(c => c.Name == request.Country);

                if (country == null)
                {
                    throw new CountryNotFoundException(request.Country);
                }
            }

            league = new TeamLeague {
                Sports  = sports,
                Name    = request.Name,
                Country = country,
                Logo    = request.Logo
            };

            foreach (var teamName in request.SelectedTeams)
            {
                var team = await context.Teams.SingleOrDefaultAsync(t => t.Name == teamName, cancellationToken);

                if (team == null)
                {
                    throw new TeamNotFoundException(teamName);
                }

                league.Competitors.Add(new Domain.Competitor.TeamCompetitor {
                    Team = team
                });
            }

            league.CreateRounds();

            context.TeamLeagues.Add(league);
            await context.SaveChangesAsync(cancellationToken);

            return(mapper.Map <TeamLeagueDto>(league));
        }
        private TeamLeague AddTeamLeague(Team team, League league)
        {
            TeamLeague teamLeague = new TeamLeague(league, team, team.TeamName, team.TeamNameLong);

            //teamLeague = teamLeagueRepository.SaveOrUpdate(teamLeague);
            //FlushSessionAndEvict(teamLeague);

            return(teamLeague);
        }
 public TeamLeagueDto(TeamLeague tl)
 {
     this.TeamId       = tl.Team.Id;
     this.TeamName     = tl.TeamName;
     this.GamesPlayed  = tl.GamesPlayed.ToString();
     this.GamesWon     = tl.GamesWonTotal.ToString();
     this.GamesLost    = tl.GamesLostTotal.ToString();
     this.GamesPct     = tl.GamesPct.ToString("0.00");
     this.PointsLeague = tl.PointsLeague.ToString();
 }
Пример #14
0
 public void Teardown()
 {
     season         = null;
     homeTeam       = null;
     homeTeam       = null;
     league         = null;
     teamLeagueHome = null;
     teamLeagueAway = null;
     fixture        = null;
 }
Пример #15
0
        public static TeamLeague CreateTeamLeague()
        {
            League league = new League(new Season(2008, 2009), "Mens", 1, 1);

            EntityIdSetter.SetIdOf(league, 1);
            Team       team       = new Team("Velocity", "Velocity");
            TeamLeague teamLeague = new TeamLeague(league, team, "Velocity", "Velocity");

            return(teamLeague);
        }
Пример #16
0
        public void GetStandingsForLeague_TwoTeamTieResolvedByFixtureLeaguePointsTwoWinsEachButOneLossForfeit_TeamBAboveA()
        {
            List <TeamLeague> basicLeagueStands = new List <TeamLeague>();
            Team forfeitingTeam = new Team()
            {
                Id = 1
            };
            TeamLeague tiedTeamA = new TeamLeague()
            {
                Id = 1, PointsLeague = 10, PointsScoredDifference = 100, Team = forfeitingTeam
            };
            TeamLeague tiedTeamB = new TeamLeague()
            {
                Id = 2, PointsLeague = 10, PointsScoredDifference = 100, Team = new Team()
                {
                    Id = 2
                },
            };

            basicLeagueStands.Add(tiedTeamA);
            basicLeagueStands.Add(tiedTeamB);
            basicLeagueStands.Add(new TeamLeague()
            {
                Id = 3, PointsLeague = 5, PointsScoredDifference = 50
            });
            mockCompetitionRepository.GetBasicStandingsForLeague(1).ReturnsForAnyArgs(basicLeagueStands.AsQueryable());

            List <Fixture> tiedTeamFixtures = new List <Fixture>();

            tiedTeamFixtures.Add(new Fixture()
            {
                HomeTeamLeague = tiedTeamA, AwayTeamLeague = tiedTeamB, HomeTeamScore = 40, AwayTeamScore = 20, IsPlayed = "Y"
            });                                                                                                                                                     // A wins
            tiedTeamFixtures.Add(new Fixture()
            {
                HomeTeamLeague = tiedTeamB, AwayTeamLeague = tiedTeamA, HomeTeamScore = 40, AwayTeamScore = 20, IsPlayed = "Y"
            });                                                                                                                                                     // B wins
            tiedTeamFixtures.Add(new Fixture()
            {
                HomeTeamLeague = tiedTeamA, AwayTeamLeague = tiedTeamB, HomeTeamScore = 40, AwayTeamScore = 20, IsPlayed = "Y"
            });                                                                                                                                                     // A wins
            tiedTeamFixtures.Add(new Fixture()
            {
                HomeTeamLeague = tiedTeamB, AwayTeamLeague = tiedTeamA, HomeTeamScore = 20, AwayTeamScore = 0, IsForfeit = true, ForfeitingTeam = forfeitingTeam, IsPlayed = "Y"
            });                                                                                                                                                                                                      // B wins (A forfeit)
            mockCompetitionRepository.GetFixturesForTeamLeagues(null).ReturnsForAnyArgs(tiedTeamFixtures);

            // B team should be top
            var standings = competitionService.GetStandingsForLeague(1);

            Assert.That(standings.Count, Is.EqualTo(3));
            Assert.That(standings[0].Id, Is.EqualTo(tiedTeamB.Id));
            Assert.That(standings[1].Id, Is.EqualTo(tiedTeamA.Id));
            Assert.That(standings[2].Id, Is.EqualTo(3));
        }
 public static int GetAwayLosses(this TeamLeague teamLeague, List <Fixture> teamFixtures, bool includeForfeitedFixtures = true)
 {
     if (includeForfeitedFixtures)
     {
         return(teamFixtures.Count(f => (f.IsAwayTeam(teamLeague) && (!f.IsAwayWin() || f.IsAwayForfeit()))));
     }
     else
     {
         return(teamFixtures.Count(f => (f.IsAwayTeam(teamLeague) && !f.IsAwayWin() && !f.IsAwayForfeit())));
     }
 }
Пример #18
0
 public ActionResult Edit(TeamLeague @teamLeague)
 {
     if (ModelState.IsValid)
     {
         teamLeagueService.Update(@teamLeague);
         teamLeagueService.Commit();
         SuccessMessage(FormMessages.SaveSuccess);
         return(RedirectToAction("Index"));
     }
     return(View(@teamLeague));
 }
        //public void AddTeamLeaguePenalty(int teamLeagueId, int penaltyPoints)
        //{
        //    TeamLeague teamLeague = teamLeagueRepository.Get(teamLeagueId);

        //    teamLeague.PointsPenalty = penaltyPoints;

        //    //teamLeague = teamLeagueRepository.SaveOrUpdate(teamLeague);
        //    //FlushSessionAndEvict(teamLeague);
        //}

        private Fixture AddFixture(int id, TeamLeague home, TeamLeague away, string fixtureDate, string resultAddedDate, User lastUpdatedBy, bool penaltyAllowed = true)
        {
            Fixture fixture = new Fixture(home, away, DateTime.Parse(fixtureDate), lastUpdatedBy);

            fixture.ResultAddedDate  = DateTime.Parse(resultAddedDate);
            fixture.IsPenaltyAllowed = penaltyAllowed;

            fixture.IsCupFixture = false;

            return(fixture);
        }
Пример #20
0
 public ActionResult Edit([Bind(Include = "TeamId,LeagueId")] TeamLeague teamLeague)
 {
     if (ModelState.IsValid)
     {
         db.Entry(teamLeague).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.LeagueId = new SelectList(db.Leagues, "LeagueId", "NameOfLeague", teamLeague.LeagueId);
     ViewBag.TeamId   = new SelectList(db.Team, "TeamId", "Name", teamLeague.TeamId);
     return(View(teamLeague));
 }
        //public void AddTeamLeaguePenalty(int teamLeagueId, int penaltyPoints)
        //{
        //    TeamLeague teamLeague = teamLeagueRepository.Get(teamLeagueId);

        //    teamLeague.PointsPenalty = penaltyPoints;

        //    //teamLeague = teamLeagueRepository.SaveOrUpdate(teamLeague);
        //    //FlushSessionAndEvict(teamLeague);
        //}

        private Fixture AddFixture(TeamLeague home, TeamLeague away, string fixtureDate, User lastUpdatedBy)
        {
            Fixture fixture = new Fixture(home, away, DateTime.Parse(fixtureDate), lastUpdatedBy);

            fixture.IsCupFixture = false;
            //fixture = fixtureRepository.SaveOrUpdate(fixture);
            //FlushSessionAndEvict(fixture);

            CurrentSeasonFixtures.Add(fixture);

            return(fixture);
        }
Пример #22
0
        public static PlayerFixture CreatePlayerFixture(int id)
        {
            Player player = CreatePlayer();

            Fixture    fixture = CreateFixture(id);
            TeamLeague tl      = CreateTeamLeague();

            PlayerFixture playerFixture = new PlayerFixture(tl, fixture, player, 10, 2);

            EntityIdSetter.SetIdOf(playerFixture, id);

            return(playerFixture);
        }
Пример #23
0
 public void Setup()
 {
     user           = new User();
     season         = new Season(2008, 2009);
     homeTeam       = new Team("home", "homeTeam");
     awayTeam       = new Team("away", "awayTeam");
     league         = new League(season, "league desc", 1, 1);
     teamLeagueHome = new TeamLeague(league, homeTeam, "home", "homeTeam");
     teamLeagueAway = new TeamLeague(league, awayTeam, "away", "awayTeam");
     player         = new Player("Phil", "Hale");
     fixtureDate    = DateTime.Today;
     fixture        = new Fixture(teamLeagueHome, teamLeagueAway, fixtureDate, user);
 }
        private Fixture AddPlayedFixture(int id, TeamLeague home, TeamLeague away, string fixtureDate, int homeScore, int awayScore, User lastUpdatedBy)
        {
            Fixture fixture = new Fixture(home, away, DateTime.Parse(fixtureDate), lastUpdatedBy);

            // myUser Result added date
            fixture.IsCupFixture  = false;
            fixture.IsPlayed      = "Y";
            fixture.HomeTeamScore = homeScore;
            fixture.AwayTeamScore = awayScore;
            fixture.Id            = id;

            return(fixture);
        }
 public void Setup()
 {
     user           = new User();
     season         = new Season(2008, 2009);
     homeTeam       = new Team("home", "homeTeam");
     homeTeam.Id    = 1;
     awayTeam       = new Team("away", "awayTeam");
     awayTeam.Id    = 2;
     league         = new League(season, "league desc", 1, 1);
     homeTeamLeague = new TeamLeague(league, homeTeam, "home", "homeTeam");
     awayTeamLeague = new TeamLeague(league, awayTeam, "away", "awayTeam");
     fixtureDate    = DateTime.Today;
 }
Пример #26
0
        // GET: TeamLeagues/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TeamLeague teamLeague = db.TeamLeagues.Find(id);

            if (teamLeague == null)
            {
                return(HttpNotFound());
            }
            return(View(teamLeague));
        }
 private void AddTeamStats(int homeTeamGoals, int awayTeamGoals, TeamLeague homeTeamLeague, TeamLeague awayTeamLeague)
 {
     if (homeTeamGoals > awayTeamGoals)
     {
         this.HomeWin(homeTeamGoals, awayTeamGoals, homeTeamLeague, awayTeamLeague);
     }
     if (awayTeamGoals > homeTeamGoals)
     {
         this.AwayWin(homeTeamGoals, awayTeamGoals, homeTeamLeague, awayTeamLeague);
     }
     if (homeTeamGoals == awayTeamGoals)
     {
         Draw(homeTeamGoals, awayTeamGoals, homeTeamLeague, awayTeamLeague);
     }
 }
Пример #28
0
        // GET: TeamLeagues/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TeamLeague teamLeague = db.TeamLeagues.Find(id);

            if (teamLeague == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LeagueId = new SelectList(db.Leagues, "LeagueId", "NameOfLeague", teamLeague.LeagueId);
            ViewBag.TeamId   = new SelectList(db.Team, "TeamId", "Name", teamLeague.TeamId);
            return(View(teamLeague));
        }
Пример #29
0
        static TeamAppearance ParseTeamStandings(JToken entry)
        {
            var        leagueDivision = entry.SafeParseToken <string>("division");
            TeamLeague league         = TeamLeague.UNKNOWN;

            if (leagueDivision.Split(' ').First().Equals("National"))
            {
                league = TeamLeague.NATIONAL;
            }
            else if (leagueDivision.Split(' ').First().Equals("American"))
            {
                league = TeamLeague.AMERICAN;
            }
            return(new TeamAppearance()
            {
                Team = new Team()
                {
                    TeamId = entry.SafeParseToken <int>("team_id", Logger),
                    Code = entry.SafeParseToken <string>("file_code", Logger),
                    FullName = entry.SafeParseToken <string>("team_full", Logger),
                    Division = leagueDivision.Split(' ').Last().ToDivision(),
                    League = league,
                },
                Standings = new Standings()
                {
                    Points = entry.SafeParseToken <int>("points", Logger),
                    Place = entry.SafeParseToken <int>("place", Logger),
                    Totals = new WinLossSplit()
                    {
                        Losses = entry.SafeParseToken <int>("l", Logger),
                        Wins = entry.SafeParseToken <int>("w", Logger),
                    },
                    Away = ParseWinLoss(entry, "away"),
                    ExtraInnings = ParseWinLoss(entry, "extra_inn"),
                    Home = ParseWinLoss(entry, "home"),
                    InterLeague = ParseWinLoss(entry, "interleague"),
                    LastTen = ParseWinLoss(entry, "last_ten"),
                    OneRunGames = ParseWinLoss(entry, "one_run"),
                    VsCentral = ParseWinLoss(entry, "vs_central"),
                    VsDivision = ParseWinLoss(entry, "vs_division"),
                    VsEast = ParseWinLoss(entry, "vs_east"),
                    VsLeft = ParseWinLoss(entry, "vs_left"),
                    VsRight = ParseWinLoss(entry, "vs_right"),
                    VsWest = ParseWinLoss(entry, "vs_west"),
                }
            });
        }
        public void IsAwayTeam_PassAwayTeam_True()
        {
            TeamLeague homeTeamLeague = new TeamLeague()
            {
                Id = 1
            };
            TeamLeague awayTeamLeague = new TeamLeague()
            {
                Id = 2
            };
            Fixture f = new Fixture()
            {
                HomeTeamLeague = homeTeamLeague, AwayTeamLeague = awayTeamLeague
            };

            Assert.That(f.IsAwayTeam(awayTeamLeague), Is.True);
        }
        private TeamLeague ResetStats(TeamLeague tl)
        {
            tl.PointsLeague = 0;
            tl.GamesPlayed = 0;
            tl.GamesPct = 0;
            tl.GamesWonTotal = 0;
            tl.GamesWonHome = 0;
            tl.GamesWonAway = 0;
            tl.GamesLostTotal = 0;
            tl.GamesLostHome = 0;
            tl.GamesLostAway = 0;
            tl.PointsScoredFor = 0;
            tl.PointsScoredAgainst = 0;
            tl.PointsScoredDifference = 0;
            tl.Streak = null;
            tl.PointsAgainstPerGameAvg = 0;
            tl.PointsScoredPerGameAvg = 0;

            return tl;
        }