public void TestPokerWithExistingListPlayers() { IPlayer p1 = new ActivePlayer("Player1",poker.Table,1); IPlayer p2 = new Bot("Player2", poker.Table, 2); IPlayer p3 = new Bot("Player3", poker.Table, 3); IPlayer p4 = new Bot("Player4", poker.Table, 4); IList<IPlayer> players = new IPlayer[] {p1, p2, p3, p4}.ToList(); poker = new Poker(players); Assert.AreEqual(4, poker.Players.Count); }
public void AddNewBot(string name) { if (Players.Count(c => c.Name.Equals(name)) == 1) { throw new InvalidOperationException("Player with name " + name + " already exist"); } if (name.Trim().Equals("")) { throw new InvalidOperationException("Name cannot be empty"); } IPlayer p = new Bot(name, Table, Players.Count + 1); p.AddCard(Deck.Draw()); p.AddCard(Deck.Draw()); p.TurnAllCards(); Players.Add(p); }