コード例 #1
0
 def test_GivenAGameWithEmptyStock_whenmoveFromWasteToStock_TheCardsAreMoved(self):
     game = GameBuilder().wasteNotEmpty().stockEmpty().build()
     expected_cards = CardStackHelper.fromCardStack(game.getWaste()).flip().reverse().getCards()
     self.assertIsNone(game.moveFromWasteToStock())
     self.assertListEqual(
         CardStackHelper.fromCardStack(game.getStock()).getCards(), expected_cards)
     self.assertTrue(game.getWaste().isEmpty())
コード例 #2
0
 def test_GivenAGame_WhenMoveFromWasteToPile_ThenCardIsMoved(self):
     pileNumber = 1
     cardToMove = CardBuilder().suit(Suit.PIKES).number(Number.ACE).faceUp().build()
     cardInPile = CardBuilder().suit(Suit.HEARTS).number(Number.TWO).faceUp().build()
     game = GameBuilder().cardInWaste(cardToMove).cardInPile(pileNumber, cardInPile).build()
     self.assertIsNone(game.moveFromWasteToPile(pileNumber))
     self.assertTrue(game.getWaste().isEmpty())
     self.assertEqual(game.getPiles()[pileNumber-1].getTop(), cardToMove)
コード例 #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)