public void testLoadAndSave() { Internationalizer.setLocale(new Locale("de", "DE")); Game g = new Game(2); Player p = g.getPlayers()[0]; p.getHand().getHand().Add(CardMother.Feast()); p.getDeck().getInDiscard().Add(CardMother.Estate()); p = g.nextTurnPlayer(); p.getHand().getHand().Add(CardMother.Village()); //Setup Done string direc = Directory.GetCurrentDirectory(); direc += "\\testSave.dom"; FileStream stream = new FileStream(direc, FileMode.OpenOrCreate,FileAccess.ReadWrite); g.SaveFile(stream); Internationalizer.setLocale(new Locale("en", "US")); stream = new FileStream(direc, FileMode.OpenOrCreate, FileAccess.ReadWrite); Game g2 = Game.LoadFile(stream); Assert.AreEqual(1, g2.getCurrentPlayerNumber()); Assert.IsTrue(g2.getCurrentPlayer().getHand().contains(CardMother.Village())); Assert.IsFalse(g2.isGameOver()); Assert.AreEqual(4, g2.getPlayers()[0].getVictoryPts()); Assert.AreEqual(3, g2.getPlayers()[1].getVictoryPts()); Assert.AreEqual(12, g2.getPlayers()[0].getDeck().size() + g2.getPlayers()[0].getHand().size()); Assert.AreEqual(11, g2.getPlayers()[1].getDeck().size() + g2.getPlayers()[1].getHand().size()); Assert.AreEqual("Aktionen", Internationalizer.getMessage("Actions")); Internationalizer.setLocale(new Locale("en", "US")); }
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()); }
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()); }
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()); }
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); }
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()); } }