def testIsNextToCardFalse(self): self.assertFalse(self.cardSUT.isNextToCard( CardBuilder().setNumber(Number.FOUR).build()))
def setUp(self): self.cardSUT = CardBuilder().build()
def testIsNextToCardTrueLess1(self): self.assertTrue(self.cardSUT.isNextToCard( CardBuilder().setNumber(Number.ACE).build()))
def testIsNextToCardTrueEquals(self): self.assertTrue(self.cardSUT.isNextToCard( CardBuilder().setNumber(Number.TWO).build()))
def addNCards(self, N): for n in range(0, N): self.cards.append(CardBuilder().build()) return self
def build(self): s = Stock() for i in range(0, self.numberOfCards): s.push(CardBuilder().build()) return s
def testFitsInFalseButIsComplete(self): self.foundationSUT.push(CardBuilder().setNumber(Number.KING).build()) self.assertFalse(self.foundationSUT.fitsIn(CardBuilder() .setSuit(SuitBuilder() .build()).build()))
def testFitsInTrueStockEmptyAndCardIsSameSuit(self): self.assertTrue(self.foundationSUT.fitsIn(CardBuilder().build()))
def testIsCompleteTrue(self): self.foundationSUT.push(CardBuilder().setNumber(Number.KING).build()) self.assertTrue(self.foundationSUT.isComplete())
def testFitsInFalseDifferentSuit(self): self.assertFalse(self.foundationSUT.fitsIn( CardBuilder().setSuit(SuitBuilder(). setInitial('h').build()).build()))
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