public void BlackjackShuffleTransactionTest_PokerDeck() { // arrange Deck.Instance = DeckFactory.CreatePokerDeck(); List <Player> players = new List <Player>(); Player alex = new Player { Name = "Alex" }; Player bill = new Player { Name = "Bill" }; Player charlie = new Player { Name = "Charlie" }; players.Add(alex); players.Add(bill); players.Add(charlie); Shuffle shuffle = new Shuffle(bill); // act shuffle.Execute(); // assert Assert.IsTrue(IsDeckShuffled(Deck.Instance)); }
public void BlackjackShuffleTransactionTest_BasicDeck() { // NOTE: A game transaction using the basic (52-card) deck requires no explicit instantiation of the deck // by the client code; a basic deck is the default Instance. // arrange List <Player> players = new List <Player>(); Player alex = new Player { Name = "Alex" }; Player bill = new Player { Name = "Bill" }; Player charlie = new Player { Name = "Charlie" }; players.Add(alex); players.Add(bill); players.Add(charlie); Shuffle shuffle = new Shuffle(bill); // act shuffle.Execute(); // assert Assert.IsTrue(IsDeckShuffled(Deck.Instance)); }
public void BlackjackIdentifyWinnerTransactionTest_BasicDeck() { // arrange List <Player> players = new List <Player>(); Player alex = new Player { Name = "Alex" }; Player bill = new Player { Name = "Bill" }; Player charlie = new Player { Name = "Charlie" }; players.Add(alex); players.Add(bill); players.Add(charlie); Shuffle shuffle = new Shuffle(bill); shuffle.Execute(); BlackjackDeal blackjackDeal = new BlackjackDeal(players, bill); Random rand = new Random(DateTime.Now.Millisecond); int upperBound = rand.Next(2, 6); // deal anywhere from 2 to 5 cards to each player for (int i = 1; i <= upperBound; i++) { blackjackDeal.Execute(); } IdentifyWinnerBlackjack identWinner = new IdentifyWinnerBlackjack(players); // act identWinner.Execute(); // assert // verify that the winner(s) has/have the highest score Assert.AreEqual(players.Where(p => p.HandStatus == HandStatus.Winner).Select(p => p.Hand.Score).Max(), players.Select(p => p.Hand.Score).Max()); }
public void BlackjackIdentifyWinnerTransactionTest_BasicDeck() { // arrange List<Player> players = new List<Player>(); Player alex = new Player { Name = "Alex" }; Player bill = new Player { Name = "Bill" }; Player charlie = new Player { Name = "Charlie" }; players.Add(alex); players.Add(bill); players.Add(charlie); Shuffle shuffle = new Shuffle(bill); shuffle.Execute(); BlackjackDeal blackjackDeal = new BlackjackDeal(players, bill); Random rand = new Random(DateTime.Now.Millisecond); int upperBound = rand.Next(2,6); // deal anywhere from 2 to 5 cards to each player for (int i = 1; i <= upperBound; i++) { blackjackDeal.Execute(); } IdentifyWinnerBlackjack identWinner = new IdentifyWinnerBlackjack(players); // act identWinner.Execute(); // assert // verify that the winner(s) has/have the highest score Assert.AreEqual(players.Where(p => p.HandStatus == HandStatus.Winner).Select(p => p.Hand.Score).Max(), players.Select(p => p.Hand.Score).Max()); }
public void BlackjackShuffleTransactionTest_PokerDeck() { // arrange Deck.Instance = DeckFactory.CreatePokerDeck(); List<Player> players = new List<Player>(); Player alex = new Player { Name = "Alex" }; Player bill = new Player { Name = "Bill" }; Player charlie = new Player { Name = "Charlie" }; players.Add(alex); players.Add(bill); players.Add(charlie); Shuffle shuffle = new Shuffle(bill); // act shuffle.Execute(); // assert Assert.IsTrue(IsDeckShuffled(Deck.Instance)); }
public void BlackjackShuffleTransactionTest_BasicDeck() { // NOTE: A game transaction using the basic (52-card) deck requires no explicit instantiation of the deck // by the client code; a basic deck is the default Instance. // arrange List<Player> players = new List<Player>(); Player alex = new Player { Name = "Alex" }; Player bill = new Player { Name = "Bill" }; Player charlie = new Player { Name = "Charlie" }; players.Add(alex); players.Add(bill); players.Add(charlie); Shuffle shuffle = new Shuffle(bill); // act shuffle.Execute(); // assert Assert.IsTrue(IsDeckShuffled(Deck.Instance)); }