Exemple #1
0
 def testIsNextToCardFalse(self):
     self.assertFalse(self.cardSUT.isNextToCard(
         CardBuilder().setNumber(Number.FOUR).build()))
Exemple #2
0
 def setUp(self):
     self.cardSUT = CardBuilder().build()
Exemple #3
0
 def testIsNextToCardTrueLess1(self):
     self.assertTrue(self.cardSUT.isNextToCard(
         CardBuilder().setNumber(Number.ACE).build()))
Exemple #4
0
 def testIsNextToCardTrueEquals(self):
     self.assertTrue(self.cardSUT.isNextToCard(
         CardBuilder().setNumber(Number.TWO).build()))
Exemple #5
0
 def addNCards(self, N):
     for n in range(0, N):
         self.cards.append(CardBuilder().build())
     return self
Exemple #6
0
 def build(self):
     s = Stock()
     for i in range(0, self.numberOfCards):
         s.push(CardBuilder().build())
     return s
Exemple #7
0
 def testFitsInFalseButIsComplete(self):
     self.foundationSUT.push(CardBuilder().setNumber(Number.KING).build())
     self.assertFalse(self.foundationSUT.fitsIn(CardBuilder()
                                                .setSuit(SuitBuilder()
                                                         .build()).build()))
Exemple #8
0
 def testFitsInTrueStockEmptyAndCardIsSameSuit(self):
     self.assertTrue(self.foundationSUT.fitsIn(CardBuilder().build()))
Exemple #9
0
 def testIsCompleteTrue(self):
     self.foundationSUT.push(CardBuilder().setNumber(Number.KING).build())
     self.assertTrue(self.foundationSUT.isComplete())
Exemple #10
0
 def testFitsInFalseDifferentSuit(self):
     self.assertFalse(self.foundationSUT.fitsIn(
         CardBuilder().setSuit(SuitBuilder().
                               setInitial('h').build()).build()))
Exemple #11
0
 def testAddToTopWhenTopFacedDownRaiseError(self):
     with pytest.raises(Exception):
         self.pileSUT.addToTop(CardBuilder().setFaceUp().build())
 def testPushWhenEmpty(self):
     self.stack.push(CardBuilder().build())
     self.assertEqual(type(CardBuilder().setFaceUp().build()),
                      type(self.stack.pop()))
 def testPopWhenNotEmpty(self):
     self.assertEqual(type(CardBuilder().setFaceUp().build()),
                      type(CardStackBuilder().addNCards(1).build().pop()))
 def setNumber(self, n):
     self.number = n
     for i in range(0, self.number):
         self.cards.append(CardBuilder().build())
     return self
 def setFacedUpCards(self, n):
     self.numberOfFacedUpCards = n
     for i in range(0, self.numberOfFacedUpCards):
         self.cards.append(CardBuilder().setFaceUp().build())
     return self