Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 def test_GivenAGame_WhenMoveFromPileToFoundation_ThenCardIsMoved(self):
     pileNumber = 1
     cardToMove = CardBuilder().suit(Suit.PIKES).number(Number.ACE).faceUp().build()
     game = GameBuilder()\
            .cardInPile(pileNumber, CardBuilder().faceUp().build())\
            .cardInPile(pileNumber, cardToMove)\
            .build()
     self.assertIsNone(game.moveFromPileToFoundation(pileNumber, Suit.PIKES))
     self.assertNotEqual(game.getPiles()[pileNumber-1].getTop(), cardToMove)
     self.assertEqual(game.getFoundations()[Suit.PIKES].getTop(), cardToMove)
     self.assertTrue(game.getPiles()[pileNumber-1].getTop().isFaceUp())        
Ejemplo n.º 3
0
 def test_GivenAGame_WhenmoveFromWasteToFoundationAndFits_ThenTheCardisMoved(self):
     game = GameBuilder().wasteWithAce(Suit.PIKES).build()
     cardTobeMoved = game.getWaste().getTop()
     self.assertIsNone(game.moveFromWasteToFoundation(Suit.PIKES))
     self.assertEqual(game.getFoundations()[Suit.PIKES].getTop(), cardTobeMoved)