public void calculate_win1() { // Card c1 = new Card(8, "C8"); Card c2 = new Card(10, "DH"); Player p = new Player(); p.add_card(c1); p.add_card(c2); int starting_bet = 10; int final_bet = 20; p.Player_Bet = starting_bet; p.bets[0] = 10; Dealer d = new Dealer(); d.Hand_Value = 17; //act p.calculate_win(d.Hand_Value); int actual = p.Player_Bet; //Assert Assert.AreEqual(final_bet, actual, "Player wins!"); }
public void split_logic2() { Card c1 = new Card(7, "7C"); Card c2 = new Card(7, "DH"); Player p = new Player(); p.add_card(c1); p.add_card(c2); p.Player_Money = 0; p.bets[0] = 10; p.Player_Bet = 10; int expected_money = 0; int expected_total = 10; bool expected = false; //Act bool actual = p.split_logic(); int actual_money = p.Player_Money; int actual_total = p.Player_Bet; Assert.AreEqual(expected_money, actual_money, "Player money should be 10"); Assert.AreEqual(expected_total, actual_total, "Total player bet should be 10"); Assert.AreEqual(expected, actual, "Player should not have another hand"); }
public void hit_logic3() { Card c1 = new Card(7, "7C"); Card c2 = new Card(10, "DH"); Card c3 = new Card(2, "2C"); Player p = new Player(); p.add_card(c1); p.add_card(c2); p.add_card(c3); bool expected = true; bool actual = p.hit_logic(); Assert.AreEqual(expected, actual, "Player does not bust on 19"); }
public void hit_logic2() { Card c1 = new Card(7, "7C"); Card c2 = new Card(10, "DH"); Card c3 = new Card(4, "4C"); Player p = new Player(); p.add_card(c1); p.add_card(c2); p.add_card(c3); bool expected = false; bool actual = p.hit_logic(); Assert.AreEqual(expected, actual, "Player stops on 21"); }
public void double_down_logic2() { Card c1 = new Card(7, "7C"); Card c2 = new Card(10, "DH"); Card c3 = new Card(4, "4C"); Player p = new Player(); string expected_status = "21"; p.add_card(c1); p.add_card(c2); p.add_card(c3); p.nr_of_hands++; p.hand[1] = new List<Card>(); p.hand[1].Add(c1); p.hand[1].Add(c2); bool expected = true; bool actual = p.double_down_logic(); string actual_status = p.Hand_Status; Assert.AreEqual(expected_status, actual_status, "Player should have 21"); Assert.AreEqual(expected, actual, "Player should have another hand"); }
public void calculate_win5() { // Card c1 = new Card(7, "/C"); Card c2 = new Card(10, "DH"); Card c3 = new Card(6, "6D"); Player p = new Player(); p.add_card(c1); p.add_card(c2); p.add_card(c3); int starting_bet = 10; int final_bet = 0; p.Player_Bet = starting_bet; p.bets[0] = starting_bet; Dealer d = new Dealer(); d.Hand_Value = 22; //act p.calculate_win(d.Hand_Value); int actual = p.Player_Bet; //Assert Assert.AreEqual(final_bet, actual, "Dealer and player bust!"); }