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 LeagueWinner(League league, Team team) : this() { Check.Require(league != null, "league must be provided"); Check.Require(team != null, "team must be provided"); this.League = league; this.Team = team; }
public CupLeague(Cup cup, League league) : this() { Check.Require(cup != null, "cup must be provided"); Check.Require(league != null, "league must be provided"); League = league; Cup = cup; }
public void LeagueNameWithDivisionValid() { Season season = new Season(2008, 2009); ; string leagueDescription = "Mens"; int divisionNo = 1; int displayOrder = 2; League league = new League(season, leagueDescription, divisionNo, displayOrder); Assert.IsNotNull(league); Assert.That(league.ToString() == "Mens Division 1"); }
public void CanCreateCupLeague() { Cup cup = new Cup("Handicap Cup"); League league = new League(new Season(2008, 2009), "League 1", 1, 1); CupLeague cupLeague = new CupLeague(cup, league); Assert.That(cupLeague.Cup.CupName, Is.EqualTo(cup.CupName)); Assert.That(cupLeague.League.Season.StartYear == 2008); Assert.That(cupLeague.League.Season.EndYear == 2009); Assert.That(cupLeague.League.LeagueDescription == league.LeagueDescription); }
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); }
public Penalty(League league, Team team, int points, string reason) : this() { Check.Require(league != null, "league must be provided"); Check.Require(team != null, "team must be provided"); Check.Require(points > 0, "points must be greater than zero"); Check.Require(!string.IsNullOrEmpty(reason) && reason.Trim() != string.Empty, "reason must be provided"); this.League = league; this.Team = team; this.Points = points; this.Reason = reason; }
public static Fixture CreateFixture(int id) { Season season = CreateSeason(); EntityIdSetter.SetIdOf(season, 1); Team team = new Team("teamName", "teamNameLong"); League league = new League(season, "league desc", 1, 1); EntityIdSetter.SetIdOf(league, 1); TeamLeague teamLeague = new TeamLeague(league, team, "teamName", "teamNameLong"); Fixture fixture = new Fixture(teamLeague, teamLeague, DateTime.Today, CreateUser()); fixture.IsCupFixture = false; EntityIdSetter.SetIdOf(fixture, id); return fixture; }
public void CanCreateLeague() { Season season = new Season(2008, 2009); ; string leagueDescription = "Mens Division"; int divisionNo = 1; int displayOrder = 2; League league = new League(season, leagueDescription, divisionNo, displayOrder); Assert.IsNotNull(league); Assert.That(league.Season.Id == season.Id); Assert.That(league.LeagueDescription == leagueDescription); Assert.That(league.DivisionNo == divisionNo); Assert.That(league.DisplayOrder == displayOrder); }
public TeamLeague(League league, Team team, string teamName, string teamNameLong) : this() { Check.Require(league != null, "league must be provided"); Check.Require(team != null, "team must be provided"); Check.Require(!string.IsNullOrEmpty(teamName) && teamName.Trim() != string.Empty, "teamName must be provided"); Check.Require(!string.IsNullOrEmpty(teamNameLong) && teamNameLong.Trim() != string.Empty, "teamName must be provided"); this.League = league; this.Team = team; this.TeamName = teamName; this.TeamNameLong = teamNameLong; }
public PlayerLeagueStats(Player player, Season season, League league, int totalPoints, int totalFouls, int gamesPlayed, int mvpAwards) : this() { Check.Require(player != null, "player must be provided"); Check.Require(season != null, "season must be provided"); Check.Require(league != null, "league must be provided"); this.Season = season; this.Player = player; this.League = league; UpdateStats(totalPoints, totalFouls, gamesPlayed, mvpAwards); }
public void Init() { season = new Season(2009, 2010); player = new Player("Phil", "Hale"); league = new League(season, "Mens", 1, 1); }
public void Dispose() { season = null; player = null; league = null; }
public LeagueViewModel() { League = new League(); League.Season = new Season(); }
public void Teardown() { season = null; homeTeam = null; homeTeam = null; league = null; teamLeagueHome = null; teamLeagueAway = null; fixture = null; }
public ActionResult Edit(League @league) { if (ModelState.IsValid) { leagueService.Update(@league); leagueService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return RedirectToAction("Index"); } return View(@league); }
private void PopulateData() { League league = new League() { Id = 1 }; ValidTeamHomeLeague = new TeamLeague() { League = league }; ValidAwayHomeLeague = new TeamLeague() { League = league }; PlayerFixturesWithStats = new List<PlayerFixture>(); PlayerFixturesWithStats.Add(new PlayerFixture() { PointsScored = 10, Fouls = 1, IsMvp = "N"}); PlayerFixturesWithStats.Add(new PlayerFixture() { PointsScored = 5, Fouls = 2, IsMvp = "Y" }); PlayerFixturesWithStatsTotalPoints = 15; PlayerFixturesWithStatsTotalFouls = 3; PlayerFixturesWithStatsGamesPlayed = PlayerFixturesWithStats.Count; PlayerFixturesWithStatsMvpAwards = 1; PlayerFixturesWithStatsPointsPerGame = (decimal)PlayerFixturesWithStatsTotalPoints / PlayerFixturesWithStatsGamesPlayed; PlayerFixturesWithStatsFoulsPerGame = (decimal)PlayerFixturesWithStatsTotalFouls / PlayerFixturesWithStatsGamesPlayed; }
public PlayerLeagueStats UpdatePlayerLeagueStats(PlayerFixture playerFixture, League league) { PlayerLeagueStats playerLeagueStats; int totalPoints = 0; int totalFouls = 0; int mvpAwards = 0; // Get all PlayerFixture records for specified league List<PlayerFixture> playerFixturesForLeague = this.statsReportingService.GetPlayerFixturesForLeagueAndPlayer(playerFixture.Player.Id, league.Id).ToList(); // Total stats foreach (PlayerFixture pf in playerFixturesForLeague) { totalPoints += pf.PointsScored; totalFouls += pf.Fouls; if (pf.IsMvp == "Y") mvpAwards++; } // Find existing record playerLeagueStats = this.statsReportingService.GetPlayerLeagueStats(playerFixture.Player.Id, league.Id); // Getting the play // If doesn't exist, create new if (playerLeagueStats == null) playerLeagueStats = new PlayerLeagueStats(playerFixture.Player, league.Season, league, totalPoints, totalFouls, playerFixturesForLeague.Count, mvpAwards); else { // Update values playerLeagueStats.UpdateStats(totalPoints, totalFouls, playerFixturesForLeague.Count, mvpAwards); } // Save matchResultRepository.SavePlayerLeagueStats(playerLeagueStats); return playerLeagueStats; }
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 LeagueWinnerTests() { season = new Season(2008, 2009); league = new League(season, "My League", 1, 1); team = new Team("Velocity", "Nunthorpe Velocity"); }
protected PlayerLeagueStats AddPlayerLeagueStats(Player player, Season season, League league, int totalPoints, int totalFouls, int gamesPlayed, int mvpAwards) { PlayerLeagueStats stats = new PlayerLeagueStats(player, season, league, totalPoints, totalFouls, gamesPlayed, mvpAwards); //statsRepository.SaveOrUpdatePlayerLeagueStats(stats); //FlushSessionAndEvict(stats); return stats; }
public void UpdatePlayerLeagueStats(List<PlayerFixture> playerFixtures, League league) { foreach (PlayerFixture pf in playerFixtures) UpdatePlayerLeagueStats(pf, league); }
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; }
public Penalty(League league, Team team, int points, string reason, Fixture fixture) : this(league, team, points, reason) { this.Fixture = fixture; }
private League AddLeague(Season season, string leagueDescription) { League league = new League(season, leagueDescription, 1, 1); //league = seasonRepository.SaveOrUpdateLeague(league); //FlushSessionAndEvict(league); return league; //Console.WriteLine("league id = " + league.Id + " - season id " + league.Season.Id); }
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 Teardown() { season = null; team = null; league = null; }
public void UpdatePlayerLeagueStats_PlayersInListAndNoExistingRecord_Success() { PlayerFixture playerFixture = new PlayerFixture() { Player = new Player() { Id = 10}}; League league = new League() { Id = 5, Season = new Season()}; this.mockStatsReportingService.GetPlayerFixturesForLeagueAndPlayer(playerFixture.Player.Id, league.Id).Returns(PlayerFixturesWithStats); this.mockStatsReportingService.GetPlayerLeagueStats(playerFixture.Player.Id, league.Id).Returns((PlayerLeagueStats)null); var returnValue = matchResultService.UpdatePlayerLeagueStats(playerFixture, league); Assert.That(returnValue, Is.Not.Null); Assert.That(returnValue.GamesPlayed, Is.EqualTo(PlayerFixturesWithStatsGamesPlayed)); Assert.That(returnValue.TotalPoints, Is.EqualTo(PlayerFixturesWithStatsTotalPoints)); Assert.That(returnValue.TotalFouls, Is.EqualTo(PlayerFixturesWithStatsTotalFouls)); Assert.That(returnValue.MvpAwards, Is.EqualTo(PlayerFixturesWithStatsMvpAwards)); Assert.That(returnValue.PointsPerGame, Is.EqualTo(PlayerFixturesWithStatsPointsPerGame)); Assert.That(returnValue.FoulsPerGame, Is.EqualTo(PlayerFixturesWithStatsFoulsPerGame)); this.mockMatchResultRepository.Received().SavePlayerLeagueStats(returnValue); }
public void Setup() { season = new Season(2008, 2009); team = new Team("name", "name"); league = new League(season, "league desc", 1, 1); }
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; }