Exemplo n.º 1
0
        public void AddPlayer(Player player)
        {
            if (CheckIfPlayerExists(player))
                throw new InvalidOperationException("Player already exists for that team.");

            this.players.Add(player);
        }
Exemplo n.º 2
0
 public void AddPlayer(Player player)
 {
     if (PlayerExists(player))
     {
         throw new InvalidOperationException("This player is already in that team");
     }
     this.players.Add(player);
 }
Exemplo n.º 3
0
        public void AddPlayer(Player player)
        {
            if (CheckIfPlayerExists(player))
            {
                throw new InvalidOperationException(
                    $"{player.FirstName} {player.LastName} already exists in {player.Team}");
            }

            players.Add(player);
        }
Exemplo n.º 4
0
 private bool CheckIfPlayerExists(Player player)
 {
     return this.players.Any(p => p.FirstName == player.FirstName &&
                                  p.LastName == player.LastName);
 }
Exemplo n.º 5
0
        public void AddPlayer(Player player)
        {
            if (this.CheckIfPlayerExist(player))
            {
                throw new InvalidOperationException(MsgConstants.PlayerExistsInTeam);
            }

            this.players.Add(player);
        }