public void AddCardToHand_OtherPlayersDidNotAddCard()
        {
            // Arrange
            WriteClass    write       = new WriteClass();
            FakeUserInput input       = new FakeUserInput();
            PlayersHand   playersHand = new PlayersHand(write, input);

            var expectedtList = new List <Player>();

            expectedtList.Add(new Player("Test", 0));
            expectedtList.Add(new Player("Test2", 1));
            expectedtList.Add(new Player("Test3", 2));

            // Act
            var    expected = input.GetStringInput();
            string deltCard = "testCard";

            playersHand.AddCardToHand(deltCard, expectedtList);

            // Assert
            foreach (var player in expectedtList)
            {
                if (player.Name != expected)
                {
                    Assert.IsFalse(player.Hand.Contains(deltCard));
                }
            }
        }
        public Hand create_players_hand_with(Chips chips_wagered, BlackJackTable black_jack_table, string hand_letter)
        {
            var players_hand = new PlayersHand(chips_wagered, black_jack_table, hand_letter);

            players_hand.mark_as_active();

            return(players_hand);
        }
Exemple #3
0
        public void Hit()
        {
            Card topCard = Deck.Draw();

            PlayersHand.AddCard(topCard);
            if (PlayersHand.Points().points > 21)
            {
                State = GameState.Lost;
            }
        }
Exemple #4
0
        public void MenuTest_ReturnValue()
        {
            FakeWriterClass writer      = new FakeWriterClass();
            FakeUserInput   userInput   = new FakeUserInput(writer);
            PlayersHand     playersHand = new PlayersHand(writer, userInput);
            ShowPlayers     showPlayers = new ShowPlayers(writer);
            Deal            deal        = new Deal();
            Menu            menu        = new Menu(writer, deal, playersHand, showPlayers, userInput);


            var mockList = new List <Player>();

            mockList.Add(new Player("Test", 0));
            mockList.Add(new Player("Test1", 1));
            mockList.Add(new Player("Test2", 2));
            var mockDeck = new List <KeyValuePair <string, string> >();

            mockDeck.Add(new KeyValuePair <string, string>("Key1", "Value1"));
            mockDeck.Add(new KeyValuePair <string, string>("Key2", "Value2"));
            mockDeck.Add(new KeyValuePair <string, string>("Key3", "Value3"));
            menu.GameMenu(mockList, mockDeck);
        }
Exemple #5
0
 public void Stay()
 {
     if (State == GameState.Lost)
     {
         return;
     }
     while (DealersHand.Points().points < 17)
     {
         Card topCard = Deck.Draw();
         DealersHand.AddCard(topCard);
     }
     if (DealersHand.Points().points > 21)
     {
         State = GameState.Won;
     }
     else if (DealersHand.Points().points < PlayersHand.Points().points)
     {
         State = GameState.Won;
     }
     else
     {
         State = GameState.Lost;
     }
 }
Exemple #6
0
 public (int points, bool soft) GetPlayerHandValue()
 {
     return(PlayersHand.Points());
 }