private void MakeMove(IPlayer player, IFrenchSuitedCard card) { try { _gameService.AcceptCard(card); player.Hand.RemoveCard(card); DisplayHands(); this.richTextBox1.AppendText($"{player.Name} played: {card.Name}\n", player.Colour); if (IsWinningMove(player)) { EndGame(player); return; } _players.Enqueue(_activePlayer); _activePlayer = _players.Dequeue(); if (_activePlayer.GamePlayStrategy == null) { _player1HandPresenter.Enabled = true; } else { var c = _activePlayer.GamePlayStrategy.GetMove(_gameService.PlayedCards, _activePlayer.Hand.Cards); MakeMove(_activePlayer, c); } } catch (KnockException) { PlayKnock(); this.richTextBox1.AppendText($"{_activePlayer.Name} Knocked\n", _activePlayer.Colour); NextPlayer(); } }
public void GIVEN_diamonds_has_not_been_played_WHEN_first_card_played_is_a_seven_of_diamonds_THEN_card_is_accepted() { // Arrange // Act _service.AcceptCard(SevenDiamonds.Object); // Assert Assert.AreEqual(1, _eventRaisedCount); Assert.AreEqual("7 Diamonds", _eventString); Assert.AreEqual(SevenDiamonds.Object, _card); }
private void PlayerOnCardPlayed(object sender, CardPlayedEventArgs e) { _gameService.AcceptCard(e.Card); _players.Enqueue(e.Player); }