Ejemplo n.º 1
0
 public void testPlayMoatAndWitch()
 {
     Game g = new Game(3);
     Player p = g.getCurrentPlayer();
     Player p2 = g.getPlayers()[1];
     Player p3 = g.getPlayers()[2];
     p2.getHand().getHand().Add(CardMother.Moat());
     p.getHand().getHand().Add(CardMother.Witch());
     p.play(CardMother.Witch());
     p2.setVictoryPts();
     p3.setVictoryPts();
     Assert.AreEqual(2, p3.getVictoryPts());
     Assert.AreEqual(3, p2.getVictoryPts());
 }
Ejemplo n.º 2
0
 public void testPlayMoatAndSpy()
 {
     Game g = new Game(3);
     Player p = g.getCurrentPlayer();
     Player p2 = g.getPlayers()[1];
     Player p3 = g.getPlayers()[2];
     p2.getHand().getHand().Add(CardMother.Moat());
     p.getHand().getHand().Add(CardMother.Spy());
     p.play(CardMother.Spy());
     List<Card> cards = p.spyOnDecks();
     p.keepOrDiscardSpiedCards(cards);
     Assert.AreEqual(0, p2.getDeck().getInDiscard().Count);
     Assert.AreEqual(1, p3.getDeck().getInDiscard().Count);
     Assert.AreEqual(1, p.getDeck().getInDiscard().Count);
 }
Ejemplo n.º 3
0
 public void testPlayMoatAndThief()
 {
     Game g = new Game(3);
     Player p = g.getCurrentPlayer();
     Player p2 = g.getPlayers()[1];
     Player p3 = g.getPlayers()[2];
     p2.getHand().getHand().Add(CardMother.Moat());
     p.getHand().getHand().Add(CardMother.Thief());
     p.play(CardMother.Thief());
     List<List<Card>> thiefed = p.getThiefList();
     Assert.AreEqual(0, thiefed[0].Count);
     Assert.AreEqual(2, thiefed[1].Count);
 }
Ejemplo n.º 4
0
 public void testPlayMoatAndBureaucrat()
 {
     Game g = new Game(3);
     Player p = g.getCurrentPlayer();
     Player p2 = g.getPlayers()[1];
     Player p3 = g.getPlayers()[2];
     p2.getHand().getHand().Add(CardMother.Moat());
     p.getHand().getHand().Add(CardMother.Bureaucrat());
     p2.getHand().getHand().Add(CardMother.Estate());
     p3.getHand().getHand().Add(CardMother.Estate());
     p.play(CardMother.Bureaucrat());
     Assert.AreEqual(CardMother.Copper(), p2.getDeck().peekAtTopCard());
     Assert.AreEqual(CardMother.Estate(), p3.getDeck().peekAtTopCard());
 }
Ejemplo n.º 5
0
 public void testPlayMoatAndMilitia()
 {
     Game g = new Game(3);
     Player p = g.getCurrentPlayer();
     Player p2 = g.getPlayers()[1];
     Player p3 = g.getPlayers()[2];
     p2.getHand().getHand().Add(CardMother.Moat());
     p.getHand().getHand().Add(CardMother.Militia());
     p.play(CardMother.Militia());
     Assert.AreEqual(0, p2.functionsToCall.Count);
     Assert.AreEqual(1, p3.functionsToCall.Count);
 }
Ejemplo n.º 6
0
 public void testPlayMilitiaSetup()
 {
     Game g = new Game(2);
     Player p = g.getCurrentPlayer();
     p.getHand().getHand().Add(CardMother.Militia());
     StatusObject o = p.play(CardMother.Militia());
     Assert.IsTrue(o.wasPlayedProperly());
     Assert.AreEqual(7, p.getCurrency());
     p = g.nextTurnPlayer();
     Assert.AreEqual(1, p.functionsToCall.Count);
     o = p.callDelayedFunctions();
     Assert.IsTrue(o.wasMilitiaPlayed());
     Assert.IsTrue(o.needToContinueWithDelayedFunctions());
     List<Card> cards = new List<Card>();
     o = p.militiaDiscardEffect(cards);
     Assert.IsTrue(o.wasMilitiaPlayed());
     cards.Add(CardMother.Copper());
     cards.Add(CardMother.Copper());
     o = p.militiaDiscardEffect(cards);
     Assert.IsFalse(o.wasMilitiaPlayed());
     Assert.IsTrue(o.needToContinueWithDelayedFunctions());
     o = p.callDelayedFunctions();
     Assert.IsFalse(o.needToContinueWithDelayedFunctions());
 }
Ejemplo n.º 7
0
 public void testPlayMoat()
 {
     Game g = new Game(3);
     Player p = g.getCurrentPlayer();
     p.getHand().getHand().Add(CardMother.Moat());
     p.play(CardMother.Moat());
     Assert.AreEqual(7, p.getHand().size());
 }
Ejemplo n.º 8
0
 public void testPlayBureaucrat()
 {
     Game g = new Game(3);
     Player p = g.getCurrentPlayer();
     p.getHand().getHand().Add(CardMother.Bureaucrat());
     g.getPlayers()[1].getHand().getHand().Add(CardMother.Duchy());
     p.play(CardMother.Bureaucrat());
     Assert.AreEqual(CardMother.Silver(), p.getDeck().getInDeck()[0]);
     p = g.nextTurnPlayer();
     Assert.AreEqual(CardMother.Duchy(), p.getDeck().getInDeck()[0]);
     p = g.nextTurnPlayer();
     Assert.AreEqual(CardMother.Copper(), p.getDeck().getInDeck()[0]);
     Console.Write(g.getGameStatus());
 }
Ejemplo n.º 9
0
 public void testPlayCouncilRoom()
 {
     Game g = new Game(2);
     Player p = g.getCurrentPlayer();
     p.getHand().getHand().Add(CardMother.CouncilRoom());
     p.play(CardMother.CouncilRoom());
     Assert.AreEqual(9, p.getHand().size());
     Assert.AreEqual(2, p.getBuysLeft());
     p = g.nextTurnPlayer();
     p.callDelayedFunctions();
     Assert.AreEqual(6, p.getHand().size());
 }
Ejemplo n.º 10
0
 public void testPlayThroneRoomAndMilitia()
 {
     Game g = new Game(2);
     Player p = g.getCurrentPlayer();
     p.getHand().getHand().Add(CardMother.Militia());
     p.getHand().getHand().Add(CardMother.ThroneRoom());
     StatusObject o = p.play(CardMother.ThroneRoom());
     o = p.play(CardMother.Militia());
     Assert.AreEqual(9, p.getCurrency());
     p = g.nextTurnPlayer();
     Assert.AreEqual(1, p.functionsToCall.Count);
 }
Ejemplo n.º 11
0
 public void testFunctionSeven()
 {
     Game g = new Game(2);
     Player p = g.getCurrentPlayer();
     Player p2 = g.getPlayers()[1];
     p.getHand().getHand().Add(CardMother.Witch());
     Assert.IsTrue(p.play(CardMother.Witch()).wasPlayedProperly());
     Assert.AreEqual(7,p.getHand().size());
     p.setVictoryPts();
     p2.setVictoryPts();
     Assert.AreEqual(3, p.getVictoryPts());
     Assert.AreEqual(2, p2.getVictoryPts());
 }
Ejemplo n.º 12
0
 public void testPlayThiefValidateCardNotStolen()
 {
     Game g = new Game(4);
     Player p = g.getCurrentPlayer();
     g.getPlayers()[1].getDeck().addCardToFront(CardMother.Gold());
     g.getPlayers()[1].getDeck().addCardToFront(CardMother.Silver());
     g.getPlayers()[2].getDeck().addCardToFront(CardMother.Feast());
     g.getPlayers()[3].getDeck().addCardToFront(CardMother.Feast());
     g.getPlayers()[3].getDeck().addCardToFront(CardMother.Feast());
     p.getHand().getHand().Add(CardMother.Thief());
     StatusObject o = p.play(CardMother.Thief());
     Assert.IsTrue(o.selectTrashFromThief());
     List<List<Card>> cards = p.getThiefList();
     Assert.AreEqual(2, cards[0].Count);
     Assert.AreEqual(1, cards[1].Count);
     Assert.AreEqual(0, cards[2].Count);
     List<Card> steal = new List<Card>();
     steal.Add(CardMother.Gold());
     steal.Add(CardMother.Silver());
     steal.Add(null);
     o = p.validateThiefStolenCards(steal);
     Assert.IsTrue(o.selectTrashFromThief());
     Assert.AreEqual(0, p.getPossibleCardsToKeepFromThief().Count);
 }
Ejemplo n.º 13
0
 public void testPlayThiefSuccess()
 {
     Game g = new Game(4);
     Player p = g.getCurrentPlayer();
     g.getPlayers()[1].getDeck().addCardToFront(CardMother.Gold());
     g.getPlayers()[1].getDeck().addCardToFront(CardMother.Silver());
     g.getPlayers()[2].getDeck().addCardToFront(CardMother.Feast());
     g.getPlayers()[3].getDeck().addCardToFront(CardMother.Feast());
     g.getPlayers()[3].getDeck().addCardToFront(CardMother.Feast());
     p.getHand().getHand().Add(CardMother.Thief());
     StatusObject o = p.play(CardMother.Thief());
     Assert.IsTrue(o.selectTrashFromThief());
     List<List<Card>> cards = p.getThiefList();
     Assert.AreEqual(2, cards[0].Count);
     Assert.AreEqual(1, cards[1].Count);
     Assert.AreEqual(0, cards[2].Count);
     List<Card> steal = new List<Card>();
     steal.Add(CardMother.Gold());
     steal.Add(CardMother.Copper());
     steal.Add(null);
     o = p.validateThiefStolenCards(steal);
     Assert.IsTrue(o.needToKeepThief());
     Assert.AreEqual(CardMother.Silver(), g.getPlayers()[1].getDeck().getInDiscard()[0]);
     List<Card> keep = new List<Card>();
     keep.Add(CardMother.Gold());
     o = p.keepCardsFromThief(keep);
     Assert.AreEqual(1, p.getDeck().getInDiscard().Count);
     Assert.AreEqual(CardMother.Gold(), p.getDeck().getInDiscard()[0]);
 }
Ejemplo n.º 14
0
 public void testPlaySpyWithNull()
 {
     Game g = new Game(4);
     Player p = g.getCurrentPlayer();
     g.getPlayers()[0].getDeck().addCardToFront(CardMother.Feast());
     g.getPlayers()[0].getDeck().addCardToFront(CardMother.Feast());
     g.getPlayers()[1].getDeck().addCardToFront(CardMother.Duchy());
     g.getPlayers()[2].getDeck().addCardToFront(CardMother.ThroneRoom());
     g.getPlayers()[3].getDeck().addCardToFront(CardMother.Militia());
     p.getHand().getHand().Add(CardMother.Spy());
     StatusObject o = p.play(CardMother.Spy());
     Assert.IsTrue(o.canSpyOnDeck());
     List<Card> cards = p.spyOnDecks();
     cards[1] = null;
     o = p.keepOrDiscardSpiedCards(cards);
     Assert.IsTrue(o.playerSpiedSuccessfully());
     Assert.AreEqual(CardMother.Feast(), g.getPlayers()[0].getDeck().getInDiscard()[0]);
     Assert.AreEqual(CardMother.Duchy(), g.getPlayers()[1].getDeck().peekAtTopCard());
     Assert.AreEqual(CardMother.ThroneRoom(), g.getPlayers()[2].getDeck().getInDiscard()[0]);
     Assert.AreEqual(CardMother.Militia(), g.getPlayers()[3].getDeck().getInDiscard()[0]);
 }
Ejemplo n.º 15
0
 public void testThiefActionWithNull()
 {
     Game g = new Game(3);
     g.getPlayers()[1].setDeck(new Deck(new List<Card>()));
     Player p = g.getCurrentPlayer();
     StatusObject o = new StatusObject(false);
     CardFunctions.thiefAction(p, o);
     List<List<Card>> thiefed = p.getThiefList();
     Assert.AreEqual(0, thiefed[0].Count);
 }
Ejemplo n.º 16
0
        public void testGainCurses()
        {
            Game mini = new Game(1);
            Player p = mini.getCurrentPlayer();
            CardFunctions.gainCurses(p);
            p.setVictoryPts();
            Assert.AreEqual(3, p.getVictoryPts());

            Game big = new Game(4);
            p = big.getCurrentPlayer();
            CardFunctions.gainCurses(p);
            p.setVictoryPts();
            Assert.AreEqual(3, p.getVictoryPts());
            for (int i = 0; i < 3; i++)
            {
                p = big.nextTurnPlayer();
                p.setVictoryPts();
                Assert.AreEqual(2, p.getVictoryPts());
            }
        }