public void GivenANewSeasonWithTheseTeamsAndPlayers(string seasonName, Table table) { var season = new Season(seasonName); var league = new League(); league.AddSeason(season); var teams = new List <Team>(); foreach (var tableRow in table.Rows) { var teamName = tableRow[0]; var team = season.Teams.FirstOrDefault(x => x.Name == teamName) ?? season.AddTeam(new Team(teamName)); var playerName = tableRow[1]; var player = team.Players.FirstOrDefault(x => x.Name == playerName) ?? team.AddPlayer(new Player(playerName)); } season.SetInContext(); league.SetInContext(); }
public bool AddSeason(League league, Season season) { return(league.AddSeason(season) == null); }