public void PlayerSingleHand_DealDeal_CorrectStartingValues() { var playerId = "8625cf04-b7e2"; var playerOne = new BlackJackPlayer(new AvitarDto() { id = "8625cf04-b7e2", userName = playerName }, HandIdentifierProvider, 1); var handId = new GuidBasedHandIdentifierProviderMock().GenerateHandIds(1).Single(); playerOne.Status = PlayerStatusTypes.Ready; playerOne.DealHands(twoThreeClubs); Assert.AreEqual(true, playerOne.Hands.Single(h => h.Identifier == handId).Cards.ElementAt(0).FaceDown); Assert.AreEqual(false, playerOne.Hands.Single(h => h.Identifier == handId).Cards.ElementAt(1).FaceDown); Assert.AreEqual(5, playerOne.Hands.Single(h => h.Identifier == handId).PointValue); Assert.AreEqual(PlayerStatusTypes.InProgress, playerOne.Status); Assert.AreEqual(playerId, playerOne.Identifier); Assert.AreEqual(1, playerOne.Hands.Count()); Assert.AreEqual(HandStatusTypes.InProgress, playerOne.Hands.Single(h => h.Identifier == handId).Status); Assert.Throws <InvalidOperationException>(() => playerOne.DealHands(twoThreeClubs)); Assert.AreEqual(true, playerOne.Hands.Single(h => h.Identifier == handId).Cards.ElementAt(0).FaceDown); Assert.AreEqual(false, playerOne.Hands.Single(h => h.Identifier == handId).Cards.ElementAt(1).FaceDown); Assert.AreEqual(5, playerOne.Hands.Single(h => h.Identifier == handId).PointValue); Assert.AreEqual(PlayerStatusTypes.InProgress, playerOne.Status); Assert.AreEqual(playerId, playerOne.Identifier); Assert.AreEqual(1, playerOne.Hands.Count()); Assert.AreEqual(HandStatusTypes.InProgress, playerOne.Hands.Single(h => h.Identifier == handId).Status); }
public void PlayerSingleHand_DealAndHit_CorrectInstanceValues() { var playerId = "8625cf04-b7e2"; var playerOne = new BlackJackPlayer(new AvitarDto() { id = "8625cf04-b7e2", userName = playerName }, HandIdentifierProvider, 1); var blkJkJackClubs = new BlackJackCard(jackClubs, true); var handId = new GuidBasedHandIdentifierProviderMock().GenerateHandIds(1).Single(); playerOne.Status = PlayerStatusTypes.Ready; playerOne.DealHands(twoThreeClubs); Assert.AreEqual(PlayerStatusTypes.InProgress, playerOne.Status); playerOne.Hit(handId, blkJkJackClubs); Assert.AreEqual(true, playerOne.Hands.Single(h => h.Identifier == handId).Cards.ElementAt(0).FaceDown); Assert.AreEqual(false, playerOne.Hands.Single(h => h.Identifier == handId).Cards.ElementAt(1).FaceDown); Assert.AreEqual(false, playerOne.Hands.Single(h => h.Identifier == handId).Cards.ElementAt(2).FaceDown); Assert.AreEqual(15, playerOne.Hands.Single(h => h.Identifier == handId).PointValue); Assert.AreEqual(PlayerStatusTypes.InProgress, playerOne.Status); Assert.AreEqual(playerId, playerOne.Identifier); Assert.AreEqual(1, playerOne.Hands.Count()); Assert.AreEqual(HandStatusTypes.InProgress, playerOne.Hands.Single(h => h.Identifier == handId).Status); }
public void NewPlayer_CalculateTotal_TotalFive() { var sam = new BlackJackPlayer(new AvitarDto() { id = "8625cf04-b7e2", userName = playerName }, HandIdentifierProvider, 1); var handId = new GuidBasedHandIdentifierProviderMock().GenerateHandIds(1).Single(); sam.Status = PlayerStatusTypes.Ready; sam.DealHands(twoThreeClubs); Assert.AreEqual(5, sam.Hands.First().PointValue); }
public void Player2Hands_HoldsOneHand_PlayerStatusInProgress() { var playerOne = new BlackJackPlayer(new AvitarDto() { id = "8625cf04-b7e2", userName = playerName }, HandIdentifierProvider, 2); var blkJkJackClubs = new BlackJackCard(jackClubs, true); var handId = new GuidBasedHandIdentifierProviderMock().GenerateHandIds(1).Single(); playerOne.Status = PlayerStatusTypes.Ready; playerOne.DealHands(twoThreeClubs2X); playerOne.Hit(handId, blkJkJackClubs); playerOne.Hold(handId); Assert.AreEqual(PlayerStatusTypes.InProgress, playerOne.Status); }