def test_GivenAGame_WhenMoveFromFoundationToPile_ThenCardIsMoved(self): pileNumber = 1 cardToMove = CardBuilder().suit(Suit.PIKES).number(Number.KING).faceUp().build() cardLeft = CardBuilder().suit(Suit.PIKES).number(Number.QUEEN).faceUp().build() game = GameBuilder().pileEmpty(pileNumber).foundationComplete(Suit.PIKES).build() self.assertIsNone(game.moveFromFoundationToPile(Suit.PIKES, pileNumber)) self.assertEqual(game.getPiles()[pileNumber-1].getTop(), cardToMove) self.assertEqual(game.getFoundations()[Suit.PIKES].getTop(), cardLeft)
def test_GivenAMoveThatDontFit_WhenMoveFromFoundationToPile_ThenError(self): pileNumber = 1 cardToMove = CardBuilder().suit(Suit.PIKES).number(Number.QUEEN).faceUp().build() game = GameBuilder().pileEmpty(pileNumber).foundationComplete(Suit.PIKES).build() game.moveFromFoundationToPile(Suit.PIKES, pileNumber) self.assertEqual(game.moveFromFoundationToPile(Suit.PIKES, pileNumber), Error.NO_FIT_PILE)
def test_GivenAEmptyFoundation_WhenMoveFromFoundationToPile_ThenError(self): pileNumber = 1 game = GameBuilder().foundationEmpty(Suit.PIKES).build() self.assertEqual( game.moveFromFoundationToPile(Suit.PIKES, pileNumber), Error.EMPTY_FOUNDATION)