public void test_d_deck_holds_52_cards() // Check if it can hold a maximum of 52 cards { var deck = CardStackFunctions.GetCardStackMock(); CardStackFunctions.FillWithCards(deck, 52); // Fill it with 52 cards Assert.That(deck.CardCount, Is.EqualTo(52)); }
public void test_e_is_shuffled() // Checks to see if cards are shuffled { //Creates 2 decks old and new, will be the same cards one will be shuffled and one will not // This will not change var unshuffledDeck = CardStackFunctions.GetCardStackMock(); // This will be shuffled var shuffledDeck = CardStackFunctions.GetCardStackMock(); CardStackFunctions.FillWithCards(unshuffledDeck, 52); CardStackFunctions.FillWithCards(shuffledDeck, 52); shuffledDeck.Shuffle(); // Shuffles only one deck int notEqualCount = 0; for (int i = 0; i < 52; i++) { int unshuffledCard = unshuffledDeck.Draw(0); int shuffledCard = shuffledDeck.Draw(0); if (unshuffledCard != shuffledCard) { notEqualCount++; } } Assert.That(notEqualCount, Is.GreaterThan(30)); }
private Blackjack GetBlackJackMock() //Simulates BlackJack { var blackJack = Substitute.For <Blackjack>(); blackJack.dealer = CardStackFunctions.GetCardStackMock(); blackJack.player = CardStackFunctions.GetCardStackMock(); blackJack.deck = CardStackFunctions.GetCardStackMock(); CardStackFunctions.FillWithCards(blackJack.deck, 52); // new text test blackJack.gameOverText = Substitute.For <Text>(); blackJack.winnerText = Substitute.For <Text>(); blackJack.playerScore = Substitute.For <Text>(); blackJack.dealerScore = Substitute.For <Text>(); blackJack.playerHandScore = Substitute.For <Text>(); blackJack.dealerHandScore = Substitute.For <Text>(); // it is unused in blackjack //blackJack.endTurnButton = Substitute.For<Button>(); blackJack.hitButton = Substitute.For <Button>(); blackJack.nextRoundButton = Substitute.For <Button>(); blackJack.playAgainButton = Substitute.For <Button>(); blackJack.standButton = Substitute.For <Button>(); blackJack.Start(); return(blackJack); }