def test__setUpCurseCards(self): self.mocker.StubOutWithMock(Game, '_makePile') Game._makePile(dominion_data.cards['curse'], dominion_rules.GAME_SETUP.CURSE_CARDS).AndReturn("curse pile") self.mocker.ReplayAll() game = Game() game._setUpCurseCards() self.assertEqual(game.SupplyArea.CursePile, "curse pile") self.mocker.VerifyAll()
def test__setUpKingdomCards(self): dominion_data.decks['first-game'] = ['cellar', 'market', 'militia', 'mine', 'moat',] self.mocker.StubOutWithMock(Game, '_makePile') for cardName in dominion_data.decks['first-game']: Game._makePile(dominion_data.cards[cardName], dominion_rules.GAME_SETUP.KINGDOM_CARDS).AndReturn("%s pile" % cardName) self.mocker.ReplayAll() game = Game() game._setUpKingdomCards() self.assertEqual(len(game.SupplyArea.KingdomPiles), 5) self.assertEqual(game.SupplyArea.KingdomPiles['Cellar'], "cellar pile") self.assertEqual(game.SupplyArea.KingdomPiles['Market'], "market pile") self.assertEqual(game.SupplyArea.KingdomPiles['Militia'], "militia pile") self.assertEqual(game.SupplyArea.KingdomPiles['Mine'], "mine pile") self.assertEqual(game.SupplyArea.KingdomPiles['Moat'], "moat pile") self.mocker.VerifyAll()
def test__setUpInitialDecks(self): game = Game() game.addPlayer(Player(name="Player 1")) game.addPlayer(Player(name="Player 2")) game.SupplyArea.EstatePile = game._makePile(dominion_data.cards['estate'], 20) game.SupplyArea.CopperPile = game._makePile(dominion_data.cards['copper'], 20) game._setUpInitialDecks() for player in game.Players: self.assertEqual(player.DrawPile.len(), 10) self.assertEqual(game.SupplyArea.EstatePile.len(), (20 - (dominion_rules.FIRST_DECK.ESTATE_CARDS * 2))) self.assertEqual(game.SupplyArea.CopperPile.len(), (20 - (dominion_rules.FIRST_DECK.COPPER_CARDS * 2)))
def test__drawFirstHands(self): game = Game() game.addPlayer(Player(name="Player 1")) game.addPlayer(Player(name="Player 2")) estatePile = game._makePile(dominion_data.cards['estate'], dominion_rules.FIRST_DECK.ESTATE_CARDS) copperPile = game._makePile(dominion_data.cards['copper'], dominion_rules.FIRST_DECK.COPPER_CARDS) for player in game.Players: firstDeck = game._combinePiles([estatePile, copperPile]) player.DrawPile = firstDeck game._drawFirstHands() for player in game.Players: self.assertEqual(player.DrawPile.len(), 5) self.assertEqual(player.Hand.len(), 5)
def test__setUpVictoryCards(self): victoryCards = 10 self.mocker.StubOutWithMock(dominion_rules, 'getGameSetupVictoryCardCount') self.mocker.StubOutWithMock(Game, '_makePile') self.mocker.StubOutWithMock(Game, '_combinePiles') dominion_rules.getGameSetupVictoryCardCount(0).AndReturn(victoryCards) Game._makePile(dominion_data.cards['estate'], victoryCards).AndReturn("estate pile") Game._makePile(dominion_data.cards['duchy'], victoryCards).AndReturn("duchy pile") Game._makePile(dominion_data.cards['province'], victoryCards).AndReturn("province pile") Game._makePile(dominion_data.cards['estate'], 0).AndReturn("additional estates") Game._combinePiles(["estate pile","additional estates"]).AndReturn("updated estate pile") self.mocker.ReplayAll() game = Game() game._setUpVictoryCards() self.assertEqual(game.SupplyArea.EstatePile, "updated estate pile") self.assertEqual(game.SupplyArea.DuchyPile, "duchy pile") self.assertEqual(game.SupplyArea.ProvincePile, "province pile") self.mocker.VerifyAll()
def test__setUpTreasureCards(self): self.mocker.StubOutWithMock(Game, '_makePile') Game._makePile(dominion_data.cards['copper'], dominion_rules.GAME_SETUP.COPPER_CARDS).AndReturn("copper pile") Game._makePile(dominion_data.cards['silver'], dominion_rules.GAME_SETUP.SILVER_CARDS).AndReturn("silver pile") Game._makePile(dominion_data.cards['gold'], dominion_rules.GAME_SETUP.GOLD_CARDS).AndReturn("gold pile") self.mocker.ReplayAll() game = Game() game._setUpTreasureCards() self.assertEqual(game.SupplyArea.CopperPile, "copper pile") self.assertEqual(game.SupplyArea.SilverPile, "silver pile") self.assertEqual(game.SupplyArea.GoldPile, "gold pile") self.mocker.VerifyAll()