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)
def test_GivenAGameWithEmptyWaste_WhenMoveFromWasteToPile_ThenError(self): pileNumber = 1 game = GameBuilder().build() self.assertEquals(game.moveFromWasteToPile(pileNumber), Error.EMPTY_WASTE)
def test_GivenAGame_WhenMoveFromWasteToPileThatDontFit_ThenError(self): pileNumber = 1 cardToMove = CardBuilder().suit(Suit.PIKES).number(Number.ACE).build() cardInPile = CardBuilder().suit(Suit.CLOVERS).number(Number.TWO).faceUp().build() game = GameBuilder().cardInWaste(cardToMove).cardInPile(pileNumber,cardInPile).build() self.assertEquals(game.moveFromWasteToPile(pileNumber), Error.NO_FIT_PILE)