public void testDraw() { Hand test = new Hand(); Deck d = new Deck(); Assert.AreEqual(0, test.getHand().Count); test.draw(d); Assert.AreEqual(1, test.getHand().Count); while (d.cardsLeft() > 0) { test.draw(d); } Assert.AreEqual(10, test.getHand().Count); Assert.IsFalse(test.draw(d)); Assert.AreEqual(10, test.getHand().Count); }
public Player(int id) { this.gain = false; this.currencyForGain = 0; this.currencyForGainBonus = 0; this.gainsLeft = 0; this.playMultipleTimes = false; this.timesToPlayLeft = 1; this.timesToPlayNextCard = 1; this.id = id; myDeck = new Deck(); myDeck.reshuffle(); myHand = new Hand(); for (int i = 0; i < 5; i++) { myHand.draw(myDeck); } timesPlayed = new List<int>(); played = new List<Card>(); victoryPts = 3; this.buysLeft = 1; this.currencyAvailable = 0; this.actionsLeft = 1; this.name = null; this.game = null; this.lastPlayedCard = null; this.trashesNeeded = 0; this.trashCurrencyBonus = 0; this.bonusCurrencyForBuy = 0; this.possibleTrashes = 0; this.otherPlayers = new List<Player>(); this.functionsToCall = new Queue<DelayedFunction>(); this.thiefList = new List<List<Card>>(); }
public void testContains() { Hand test = new Hand(); Card estate = new Card(0, 0, 0, 0, 1, 0, 0, "Estate", "1 Victory Point", 2, "Estate"); Card copper = new Card(1, 1, 0, 0, 0, 0, 0, "Copper", "1 Currency", 0, "Copper"); Card other = new Card(0, 0, 0, 0, 0, 0, 0, "NULL", "NULL", 0, "Null"); List<Card> smallDeck = new List<Card>(); smallDeck.Add(estate); smallDeck.Add(copper); Deck toDraw = new Deck(smallDeck); Assert.IsFalse(test.contains(estate)); test.draw(toDraw); Assert.IsTrue(test.contains(estate)); Assert.IsFalse(test.contains(copper)); test.draw(toDraw); Assert.IsTrue(test.contains(copper)); Assert.IsFalse(test.contains(other)); }
public void testDiscard() { Hand test = new Hand(); Deck d = new Deck(); test.draw(d); Assert.AreEqual(1, test.getHand().Count); test.discard(test.getHand()[0], d); Assert.AreEqual(0, test.getHand().Count); Assert.AreEqual(1, d.getInDiscard().Count); Assert.IsFalse(test.discard(new Card(0, 0, 0, 0, 0, 0, 0, "Null", "Null", 0, "Null"), d)); Assert.AreEqual(1, d.getInDiscard().Count); }
public void testGetCurrency() { Hand test = new Hand(); Deck d = new Deck();//default with seven coppers in front. Assert.AreEqual(0, test.getCurrency()); test.draw(d); Assert.AreEqual(1, test.getCurrency()); for (int i = 0; i < 6; i++) { test.draw(d); } Assert.AreEqual(7, test.getCurrency()); test.draw(d); Assert.AreEqual(7, test.getCurrency()); }
public void testGetFirstVictoryCard() { Hand test = new Hand(); Deck d = new Deck(); test.draw(d); test.draw(d); test.getHand().Add(CardMother.Duchy()); test.getHand().Add(CardMother.Estate()); Assert.AreEqual(CardMother.Duchy(), test.getFirstVictoryCard()); }
public void testSize() { Hand test = new Hand(); Deck d = new Deck(); Assert.AreEqual(0,test.size()); test.draw(d); Assert.AreEqual(1, test.size()); }
public void testRemoveCardNotInHand() { Hand test = new Hand(); Deck d = new Deck(); test.draw(d); Card copper = CardMother.Copper(); Assert.AreEqual(copper, test.remove(copper)); Assert.IsNull(test.remove(copper)); test.draw(d); Card estate = CardMother.Estate(); Assert.IsNull(test.remove(estate)); }
public void testGetFirstVictoryCardNoVictory() { Hand test = new Hand(); Deck d = new Deck(); test.draw(d); test.draw(d); Assert.IsNull(test.getFirstVictoryCard()); }
public void cleanUp() { foreach (Card c in myHand.getHand()) { myDeck.discard(c); } foreach (Card c in this.played) { myDeck.discard(c); } myHand = new Hand(); for (int i = 0; i < 5; i++) { myHand.draw(myDeck); } this.buysLeft = 1; this.actionsLeft = 1; this.played = new List<Card>(); this.timesPlayed = new List<int>(); this.gain = false; this.gainsLeft = 0; this.playMultipleTimes = false; this.timesToPlayLeft = 1; }