public void Test_AddPlayer_SeatNotEmpty_ThrowsException() { Table table = new Table(4); table.AddPlayer(new Player(500, 0), 3); Exception exception = Assert.Throws <Exception>(() => table.AddPlayer(new Player(500, 0), 3)); Assert.AreEqual(exception.Message, "Sorry, this seat has already a player"); }
public void Test_RemovePlayer_DoesNotExist_ThrowsException() { Table table = new Table(4); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); Exception exception = Assert.Throws <Exception>(() => table.RemovePlayer(new Player(500, 0))); Assert.AreEqual(exception.Message, "This player is not sitting in the table"); }
public void Test_RemovePlayer_FromSeatNumber_IsOk(int seatNumber) { Table table = new Table(4); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); Assert.DoesNotThrow(() => table.RemovePlayer(seatNumber)); }
public void Test_RemovePlayer_FromNonExistingSeat_ThrowsException() { Table table = new Table(4); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); Exception exception = Assert.Throws <Exception>(() => table.RemovePlayer(8)); Assert.AreEqual(exception.Message, "Sorry, seat not found"); }
public void Test_RemovePlayer_FromEmptySeat_ThrowsException() { Table table = new Table(4); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); Exception exception = Assert.Throws <Exception>(() => table.RemovePlayer(3)); Assert.AreEqual(exception.Message, "This seat is empty"); }
public void Test_AddPlayer_TableAlreadyContainsPlayer_ThrowsException() { Table table = new Table(4); var player = new Player(500, 0); table.AddPlayer(player); Exception exception = Assert.Throws <Exception>(() => table.AddPlayer(player)); Assert.AreEqual(exception.Message, "Sorry, selected player is already playing"); }
public void Test_IsAnyEmpty_HasSomeEmptySeats_ReturnsTrue() { Table table = new Table(5); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); bool expected = table.Seats.IsAnyEmpty(); Assert.AreEqual(expected, true); }
public void Test_StartGame_BoardStateIsPreFlop_IsTrue() { Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.StartGame(); Assert.AreEqual(table.Board.BoardState, BoardStateType.Preflop); }
public void Test_SetDealer_EmptySeat_ThrowsException() { Player playerDealer = new Player(500, 0); Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0), 1); table.AddPlayer(new Player(500, 0), 3); table.AddPlayer(new Player(500, 0), 4); var exception = Assert.Throws <Exception>(() => table.SetDealer(2)); Assert.AreEqual(exception.Message, "Sorry, selected seat is empty!"); }
public void Test_AddPlayer_HasNoEmptySeats_ThrowsException() { Table table = new Table(4); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); Exception exception = Assert.Throws <Exception>(() => table.AddPlayer(new Player(500, 0))); Assert.AreEqual(exception.Message, "Sorry, no empty seat found"); }
public void Test_Turn_BoardStateIsTurn_IsTrue() { Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.StartGame(); table.Flop(); table.Turn(); Assert.AreEqual(table.Board.BoardState, BoardStateType.Turn); }
public void Test_SetDealer_SpecificPlayer_IsOk() { Player playerDealer = new Player(500, 0); Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0), 1); table.AddPlayer(playerDealer, 3); table.AddPlayer(new Player(500, 0), 4); table.SetDealer(3); Assert.IsTrue(playerDealer.IsDealer); }
public void Test_StartGame_WithPlayers_HaveCards(int seatNumber) { Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.StartGame(); bool expected = table.Players.ToList()[seatNumber].HasCards(); Assert.AreEqual(expected, true); }
public void Test_SetDealer_SmallBlind_IsOk(int dealer, int smallBlind) { Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0), 1); table.AddPlayer(new Player(500, 0), 3); table.AddPlayer(new Player(500, 0), 4); table.SetDealer(dealer); var expected = table.Seats[smallBlind].Player.IsSmallBlind; Assert.IsTrue(expected); }
public void Test_Turn_AfterStartGame_ThrowsException() { Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.StartGame(); Exception exception = Assert.Throws <Exception>(() => table.Turn()); Assert.AreEqual(exception.Message, "The board has to go through Flop first!"); }
public void Test_River_WhenInFlop_ThrowsException() { Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.AddPlayer(new Player(500, 0)); table.StartGame(); table.Flop(); Exception exception = Assert.Throws <Exception>(() => table.River()); Assert.AreEqual(exception.Message, "The board has to go through Turn first!"); }
public void Test_AddPlayer_SeatDoesNotExist_ThrowsException() { Table table = new Table(4); Exception exception = Assert.Throws <Exception>(() => table.AddPlayer(new Player(500, 0), 12)); Assert.AreEqual(exception.Message, "Sorry, invalid seat number"); }
public void Test_SetDealer_BigBlind_IsOk(int dealer, int bigBlind) { Player playerBigBlind = new Player(500, 0); Table table = new Table(4, 0); table.AddPlayer(new Player(500, 0), 1); table.AddPlayer(new Player(500, 0), 2); table.AddPlayer(playerBigBlind, 3); table.AddPlayer(new Player(500, 0), 4); table.SetDealer(dealer); var expected = table.Seats[bigBlind].Player.IsBigBlind; Assert.IsTrue(expected); }
public void Test_RemovePlayer_ByExistingPlayer_IsOk() { Table table = new Table(4); Player player = new Player(500, 0); table.AddPlayer(player); Assert.DoesNotThrow(() => table.RemovePlayer(player)); }