public void PlayHandWhenTwoCardsAreLeftShouldMoveTheGameToTheFinalRoundState() { var haveStateMock = new Mock<IStateManager>(); var roundState = new TwoCardsLeftRoundState(haveStateMock.Object); roundState.PlayHand(0); haveStateMock.Verify(x => x.SetState(It.IsAny<FinalRoundState>()), Times.Once); }
public void CloseShouldNotChangeGameState() { // It is not allowed to close the game in this state var haveStateMock = new Mock<IStateManager>(); var roundState = new TwoCardsLeftRoundState(haveStateMock.Object); roundState.Close(); haveStateMock.Verify(x => x.SetState(It.IsAny<BaseRoundState>()), Times.Never); }
public void CloneShouldReturnObjectOfTypePlayerTurnContext() { var haveStateMock = new Mock<IStateManager>(); var state = new TwoCardsLeftRoundState(haveStateMock.Object); var playerTurnContext = new PlayerTurnContext(state, new Card(CardSuit.Diamond, CardType.Ace), 2, 0, 0); var clonedPlayerTurnContext = playerTurnContext.DeepClone(); Assert.IsInstanceOf<PlayerTurnContext>(clonedPlayerTurnContext); }
public void CanCloseGameShouldReturnFalseWhenThePlayerIsFirstButTheStateDoesNotPermitClosing() { var haveStateMock = new Mock<IStateManager>(); var roundState = new TwoCardsLeftRoundState(haveStateMock.Object); var canCloseGame = CloseGameActionValidator.CanCloseGame(true, roundState); Assert.IsFalse(canCloseGame); }
public void WhenTwoCardsAreLeftRulesShouldNotBeObserved() { var haveStateMock = new Mock<IStateManager>(); var roundState = new TwoCardsLeftRoundState(haveStateMock.Object); Assert.IsFalse(roundState.ShouldObserveRules); }
public void WhenTwoCardsAreLeftItIsPossibleToAnnounce20Or40() { var haveStateMock = new Mock<IStateManager>(); var roundState = new TwoCardsLeftRoundState(haveStateMock.Object); Assert.IsTrue(roundState.CanAnnounce20Or40); }
public void WhenTwoCardsAreLeftItIsNotPossibleToCloseTheGame() { var haveStateMock = new Mock<IStateManager>(); var roundState = new TwoCardsLeftRoundState(haveStateMock.Object); Assert.IsFalse(roundState.CanClose); }
public void WhenTwoCardsAreLeftCardShouldBeDrawn() { var haveStateMock = new Mock<IStateManager>(); var roundState = new TwoCardsLeftRoundState(haveStateMock.Object); Assert.IsTrue(roundState.ShouldDrawCard); }