예제 #1
0
        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();
        }
예제 #2
0
 public bool AddSeason(League league, Season season)
 {
     return(league.AddSeason(season) == null);
 }