public void TestBuildRoad() { var target = new Player(); target.incrementSettlements(); target.generateBrick(); target.generateLumber(); target.buildRoad(); Assert.AreEqual(0, target.getHand().getBrick()); Assert.AreEqual(0, target.getHand().getLumber()); }
public void TestTradeForGrainAtPortThrowsWhenBankHasNone() { World world = new World(); var player1 = new Player("Bob", Color.Red, world); var player2 = new Player("Jim", Color.Blue, world); player1.incrementSettlements(); player2.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementSettlements(); player1.generateGrain(); player2.generateGrain(); player2.generateGrain(); Assert.AreEqual(0, world.bank.getGrainRemaining()); player1.generateOre(); player1.generateOre(); player1.generateOre(); player1.tradeAtPort(3, "grain", "ore"); }
public void TestTradeForDevCardThrowsWhenBankHasNoDevCards() { var target = new Player(); target.incrementCities(); target.incrementCities(); target.incrementSettlements(); for (int i = 0; i < 5; i++) { target.generateGrain(); target.generateOre(); target.generateWool(); for (int j = 0; j < 5; j++) { target.tradeForDevCard(); } } target.generateGrain(); target.generateOre(); target.generateWool(); // should generate an exception target.tradeForDevCard(); }
public void TestTradeForDevCard() { var target = new Player(); target.incrementSettlements(); target.generateWool(); target.generateGrain(); target.generateOre(); target.tradeForDevCard(); Assert.AreEqual(0, target.getHand().getResources()); Assert.AreEqual(1, target.getHand().getDevCardCount()); }
public void TestTradeBrickWithBankWithAnythingPort() { var target = new Player(); target.incrementCities(); target.incrementSettlements(); target.generateBrick(); target.addPort(new Port("Anything", 3)); target.tradeWithBank("brick", "lumber"); Assert.AreEqual(1, target.playerHand.getLumber()); Assert.AreEqual(0, target.playerHand.getBrick()); }
public void TestTradeAtPort() { var target = new Player(); target.incrementCities(); target.incrementSettlements(); target.generateBrick(); target.generateGrain(); target.generateLumber(); target.generateOre(); target.generateWool(); target.tradeAtPort(3, "grain", "brick"); target.tradeAtPort(3, "lumber", "grain"); target.tradeAtPort(3, "ore", "lumber"); target.tradeAtPort(3, "wool", "ore"); target.tradeAtPort(3, "brick", "wool"); Assert.AreEqual(1, target.getHand().getGrain()); Assert.AreEqual(1, target.getHand().getLumber()); Assert.AreEqual(1, target.getHand().getOre()); Assert.AreEqual(1, target.getHand().getWool()); Assert.AreEqual(1, target.getHand().getBrick()); }
public void TestRob() { var target = new Player(); target.incrementSettlements(); target.generateLumber(); Assert.AreEqual("lumber", target.rob()); Assert.AreEqual(0, target.playerHand.getLumber()); target.generateBrick(); Assert.AreEqual("brick", target.rob()); Assert.AreEqual(0, target.playerHand.getBrick()); target.generateGrain(); Assert.AreEqual("grain", target.rob()); Assert.AreEqual(0, target.playerHand.getGrain()); target.generateWool(); Assert.AreEqual("wool", target.rob()); Assert.AreEqual(0, target.playerHand.getWool()); target.generateOre(); Assert.AreEqual("ore", target.rob()); Assert.AreEqual(0, target.playerHand.getOre()); }
public void TestPickString() { var target = new Player(); target.incrementSettlements(); List<string> resources = new List<string>(); target.generateLumber(); resources.Add("lumber"); Assert.AreEqual("lumber", target.pickString(resources)); Assert.AreEqual(0, target.playerHand.getLumber()); resources.Remove("lumber"); target.generateBrick(); resources.Add("brick"); Assert.AreEqual("brick", target.pickString(resources)); Assert.AreEqual(0, target.playerHand.getBrick()); resources.Remove("brick"); target.generateGrain(); resources.Add("grain"); Assert.AreEqual("grain", target.pickString(resources)); Assert.AreEqual(0, target.playerHand.getGrain()); resources.Remove("grain"); target.generateWool(); resources.Add("wool"); Assert.AreEqual("wool", target.pickString(resources)); Assert.AreEqual(0, target.playerHand.getWool()); resources.Remove("wool"); target.generateOre(); resources.Add("ore"); Assert.AreEqual("ore", target.pickString(resources)); Assert.AreEqual(0, target.playerHand.getOre()); resources.Remove("ore"); }
public void TestGenerateWoolWithSettlementsThrowsWhenBankHasInsufficientResources() { var target = new Player(); target.incrementSettlements(); target.incrementSettlements(); target.incrementSettlements(); target.incrementSettlements(); target.incrementSettlements(); Assert.AreEqual(0, target.getSettlementsRemaining()); target.generateWool(); target.generateWool(); target.generateWool(); Assert.AreEqual(15, target.getHand().getWool()); target.generateWool(); }
public void TestTransferWool() { var target = new Player(); target.incrementSettlements(); target.generateWool(); target.transferWool(1); }
public void TestGenerateResourcesWithOnlySettlements() { var target = new Player(); target.incrementSettlements(); target.incrementSettlements(); Assert.AreEqual(3, target.getSettlementsRemaining()); target.generateBrick(); target.generateGrain(); target.generateLumber(); target.generateOre(); target.generateWool(); Assert.AreEqual(2, target.getHand().getBrick()); Assert.AreEqual(2, target.getHand().getGrain()); Assert.AreEqual(2, target.getHand().getLumber()); Assert.AreEqual(2, target.getHand().getOre()); Assert.AreEqual(2, target.getHand().getWool()); }
public void TestTradeWoolWithBankWithAnythingPort() { var target = new Player(); target.incrementCities(); target.incrementSettlements(); target.generateWool(); target.addPort(new Port("Anything", 3)); target.tradeWithBank("wool", "grain"); Assert.AreEqual(1, target.playerHand.getGrain()); Assert.AreEqual(0, target.playerHand.getWool()); }
public void TestTradeWithBankForWoolThrowsWhenBankHasNone() { World world = new World(); var player1 = new Player("Bob", Color.Red, world); var player2 = new Player("Jim", Color.Blue, world); player1.incrementCities(); player1.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementSettlements(); player2.generateWool(); player2.incrementSettlements(); player2.generateWool(); Assert.AreEqual(0, world.bank.getWoolRemaining()); player1.generateBrick(); player1.tradeWithBank("brick", "wool"); }
public void TestTradeWithBankForOreThrowsWhenBankHasNone() { World world = new World(); var player1 = new Player("Bob", Color.Red, world); var player2 = new Player("Jim", Color.Blue, world); player1.incrementCities(); player1.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementSettlements(); player2.generateOre(); player2.incrementSettlements(); player2.generateOre(); Assert.AreEqual(0, world.bank.getOreRemaining()); player1.generateLumber(); player1.tradeWithBank("lumber", "ore"); }
public void TestCanBuildSettlement() { var target = new Player(); Assert.IsFalse(target.canBuildSettlement()); target.incrementSettlements(); target.generateBrick(); target.generateLumber(); target.generateGrain(); target.generateWool(); Assert.IsTrue(target.canBuildSettlement()); }
public void TestTradeForWoolAtPortThrowsWhenBankHasNone() { World world = new World(); var player1 = new Player("Bob", Color.Red, world); var player2 = new Player("Jim", Color.Blue, world); player1.incrementSettlements(); player2.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementCities(); player2.incrementSettlements(); player1.generateWool(); player2.generateWool(); player2.generateWool(); Assert.AreEqual(0, world.bank.getWoolRemaining()); player1.generateLumber(); player1.generateLumber(); player1.generateLumber(); player1.tradeAtPort(3, "wool", "lumber"); }