public void Game_Start_GameStatus_InProcess()
        {
            //Arrange
            Dealer dealer = new Dealer(new List <Deck> {
                new Deck()
            }, 0);
            Player player = new Player(0);

            //Act
            var table = new GameTable(dealer, player, _Settlement);

            table.GameStart();
            //Assert
            Assert.AreEqual(GameStatus.PlayerInProcess, table.GameStatus);
        }
        public void Player_Turn_Player_Hit_Get_One_Card()
        {
            //Arrange
            Dealer dealer = new Dealer(new List <Deck> {
                new Deck()
            }, 0);
            Player player = new Player(0);

            //Act
            var table = new GameTable(dealer, player, _Settlement);

            table.GameStart();
            table.Hit();
            //Assert
            Assert.AreEqual(3, table.PlayerHand.Count);
        }
        public void Player_Turn_Player_Stay_Become_Dealer_Turn()
        {
            //Arrange
            Dealer dealer = new Dealer(new List <Deck> {
                new Deck()
            }, 0);
            Player player = new Player(0);

            //Act
            var table = new GameTable(dealer, player, _Settlement);

            table.GameStart();
            table.Stay();
            //Assert
            Assert.AreEqual(2, table.PlayerHand.Count);
            Assert.AreEqual(Turn.Dealer, table.Turn);
        }
        public void Dealer_Turn_Will_Hit_Until_Larger_Than(int score)
        {
            //Arrange
            Dealer dealer = new Dealer(new List <Deck> {
                new Deck()
            }, 0);
            Player player = new Player(0);

            //Act
            var table = new GameTable(dealer, player, _Settlement);

            table.GameStart();
            table.Stay();
            table.Hit();
            //Assert
            Assert.IsTrue(table.DealerHandScore > 16);
        }
Beispiel #5
0
        public void Hidden_Card_Display_As_X()
        {
            //Arrange
            Dealer dealer = new Dealer(new List <Deck> {
                new Deck()
            }, 0);
            Player player    = new Player(0);
            var    table     = new GameTable(dealer, player, _Settlement);
            var    viewModle = new BlackJackViewModel(table);

            //Act
            table.GameStart();
            var result = viewModle.DealerHand;

            //Assert
            Assert.IsTrue(result.Any(x => x == "X"));
        }
        public void Game_Start_Dealer_Get_Two_Cards_And_One_Hidden_Player_Get_Two_Cards()
        {
            //Arrange
            Dealer dealer = new Dealer(new List <Deck> {
                new Deck()
            }, 0);
            Player player = new Player(0);

            //Act
            var table = new GameTable(dealer, player, _Settlement);

            table.GameStart();
            //Assert
            Assert.AreEqual(2, table.DealerHand.Count);
            Assert.AreEqual(1, table.DealerHand.Count(x => x.IsHidden));
            Assert.AreEqual(2, table.PlayerHand.Count);
            Assert.AreEqual(Turn.Player, table.Turn);
        }
        public void Game_End_If_Player_Exceeds_21()
        {
            //Arrange
            Dealer dealer = new Dealer(new List <Deck> {
                new Deck()
            }, 0);
            Player player = new Player(0);

            //Act
            var table = new GameTable(dealer, player, _Settlement);

            table.GameStart();
            while (table.PlayerHandScore <= 21)
            {
                table.Hit();
            }
            //Assert
            Assert.AreEqual(GameStatus.End, table.GameStatus);
        }