예제 #1
0
    def __init__(self):
        self._game = Game()
        self._foundations = {
            Suit.HEARTS: FoundationBuilder().suit(Suit.HEARTS).build(),
            Suit.DIAMONDS: FoundationBuilder().suit(Suit.DIAMONDS).build(),
            Suit.CLOVERS: FoundationBuilder().suit(Suit.CLOVERS).build(),
            Suit.PIKES: FoundationBuilder().suit(Suit.PIKES).build()
        }

        self._waste = None
        self._stock = None
예제 #2
0
 def foundationComplete(self, suit=Suit.PIKES):
     self._foundations[suit] = FoundationBuilder().suit(suit).cards(
         13).build()
     return self
예제 #3
0
 def foundationEmpty(self, suit=Suit.PIKES):
     self._foundations[suit] = FoundationBuilder().build()
     return self
예제 #4
0
 def test_GivenNotemptyFoundation_whenCardFaceDownAskFitsIn_ReturnFalse(
         self):
     foundation = FoundationBuilder().suit(Suit.PIKES).cards(3).build()
     card = CardBuilder().suit(Suit.PIKES).number(Number.FOUR).build()
     self.assertFalse(foundation.isFittingIn(card))
예제 #5
0
 def test_GivenemptyFoundation_whenAskEmpty_ReturnTrue(self):
     foundation = FoundationBuilder().build()
     self.assertTrue(foundation.isEmpty())
예제 #6
0
 def test_GivenAemptyFoundation_whenNotAceAsksFitsIn_ReturnFalse(self):
     foundation = FoundationBuilder().suit(Suit.PIKES).build()
     card = CardBuilder().suit(Suit.PIKES).number(
         Number.TWO).faceUp().build()
     self.assertFalse(foundation.isFittingIn(card))
예제 #7
0
 def test_GivenNotemptyFoundation_whenCardthatFitsAskFitsIn_ReturnTrue(
         self):
     foundation = FoundationBuilder().suit(Suit.PIKES).cards(3).build()
     card = CardBuilder().suit(Suit.PIKES).number(
         Number.FOUR).faceUp().build()
     self.assertTrue(foundation.isFittingIn(card))
예제 #8
0
 def test_GivenAemptyFoundation_whenAceofOtherSuitAsksFitsIn_ReturnFalse(
         self):
     foundation = FoundationBuilder().suit(Suit.CLOVERS).build()
     card = CardBuilder().suit(Suit.PIKES).number(Number.ACE).build()
     self.assertFalse(foundation.isFittingIn(card))
예제 #9
0
 def test_GivenAemptyFoundation_whenAceofSuitAsksFitsIn_ReturnTrue(self):
     foundation = FoundationBuilder().suit(Suit.PIKES).build()
     card = CardBuilder().suit(Suit.PIKES).number(
         Number.ACE).faceUp().build()
     self.assertTrue(foundation.isFittingIn(card))
예제 #10
0
 def test_GivenAemptyFoundation_whenAceFaceDownaddToTop_ThenException(self):
     foundation = FoundationBuilder().suit(Suit.PIKES).build()
     card = CardBuilder().suit(Suit.PIKES).number(Number.ACE).build()
     with self.assertRaises(InvalidCard) as context:
         foundation.addToTop(card)
예제 #11
0
 def test_GivenAnotCompletePile_whenIsCompleteAsked_ReturnFalse(self):
     foundation = FoundationBuilder().cards(1).build()
     self.assertFalse(foundation.isComplete())
예제 #12
0
 def test_GivenACompletePile_whenIsCompleteAsked_ReturnTrue(self):
     foundation = FoundationBuilder().cards(13).build()
     self.assertTrue(foundation.isComplete())