コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        public void CanCloseGameShouldReturnFalseWhenThePlayerIsFirstButTheStateDoesNotPermitClosing()
        {
            var haveStateMock = new Mock<IStateManager>();
            var roundState = new TwoCardsLeftRoundState(haveStateMock.Object);

            var canCloseGame = CloseGameActionValidator.CanCloseGame(true, roundState);
            Assert.IsFalse(canCloseGame);
        }
コード例 #5
0
 public void WhenTwoCardsAreLeftRulesShouldNotBeObserved()
 {
     var haveStateMock = new Mock<IStateManager>();
     var roundState = new TwoCardsLeftRoundState(haveStateMock.Object);
     Assert.IsFalse(roundState.ShouldObserveRules);
 }
コード例 #6
0
 public void WhenTwoCardsAreLeftItIsPossibleToAnnounce20Or40()
 {
     var haveStateMock = new Mock<IStateManager>();
     var roundState = new TwoCardsLeftRoundState(haveStateMock.Object);
     Assert.IsTrue(roundState.CanAnnounce20Or40);
 }
コード例 #7
0
 public void WhenTwoCardsAreLeftItIsNotPossibleToCloseTheGame()
 {
     var haveStateMock = new Mock<IStateManager>();
     var roundState = new TwoCardsLeftRoundState(haveStateMock.Object);
     Assert.IsFalse(roundState.CanClose);
 }
コード例 #8
0
 public void WhenTwoCardsAreLeftCardShouldBeDrawn()
 {
     var haveStateMock = new Mock<IStateManager>();
     var roundState = new TwoCardsLeftRoundState(haveStateMock.Object);
     Assert.IsTrue(roundState.ShouldDrawCard);
 }