public void AddPlayer(string playerName, string playerMoney) { decimal moneyDecimal; if (decimal.TryParse(playerMoney, out moneyDecimal)) { Player player = new Player(playerName, moneyDecimal); if (moneyDecimal < Bet.MINIMUM_BET) { throw new ArgumentOutOfRangeException("moneyDecimal", String.Format("Amount: {0} is below minimum bet amount: {1}", moneyDecimal, Bet.MINIMUM_BET)); } if (!_players.Add(player)) { throw new ArgumentException(String.Format("Player with name '{0}' already exists", playerName)); } } else { throw new InvalidCastException("Invalid format for money"); } }
public Bet(Player player, Greyhound greyhound, decimal amount) { Player = player; Greyhound = greyhound; Amount = amount; }