public void TestThatIntersectionCanDetemineWhenPlayerHasExistingConnection() { var world = new World(3, 0, null); Player player = new Player("sam", Color.Turquoise, world); player.getHand().incrementAllResources(3); world.addPlayer(player); world.setCurrentPlayer(player.getName()); Assert.AreNotEqual(Color.White, world.tryToBuildAtIntersection(new Point(2, 4))); Assert.AreNotEqual(Color.White, world.roadButtonClicked(new Point(4, 4))); Assert.True(world.getMap().getIslandMap().getIntAtIndex(new Point(2, 5)).playerHasExistingConnection(Color.Turquoise)); }
public void TestThatVerticalRoadIsBuiltIfPlayerHasSettlement() { World world = new World(3, 0, null); Player player1 = new Player("Meeeeee!", Color.HotPink, world); world.addPlayer(player1); world.setCurrentPlayer(player1.getName()); // Give player 5 resources of each except ore player1.getHand().modifyBrick(5); player1.getHand().modifyGrain(5); player1.getHand().modifyLumber(5); player1.getHand().modifyWool(5); world.tryToBuildAtIntersection(new Point(0, 2)); Assert.AreEqual(Color.HotPink, world.roadButtonClicked(new Point(1, 0))); }
public void TestThatBuildingRoadReturnsWhiteIfIndexIsOutOfRange() { World world = new World(3, 0, null); Player player1 = new Player("Meeeeee!", Color.HotPink, world); world.addPlayer(player1); world.setCurrentPlayer(player1.getName()); // Give player 5 resources of each except ore player1.getHand().modifyBrick(5); player1.getHand().modifyGrain(5); player1.getHand().modifyLumber(5); player1.getHand().modifyWool(5); world.tryToBuildAtIntersection(new Point(0, 2)); Assert.AreEqual(Color.White, world.roadButtonClicked(new Point(52, 1))); }
public void TestRoadButtonClicked() { World w = new World(3, 0, null); Player player1 = new Player("Meeeeee!", Color.HotPink, w); w.addPlayer(player1); w.setCurrentPlayer(player1.getName()); Color C = w.roadButtonClicked(new Point(2, 2)); //insufficiant resources Assert.AreEqual(Color.White, C); w.currentPlayer.getHand().incrementAllResources(5); //point without adjoining settlement C = w.roadButtonClicked(new Point(3, 2)); Assert.AreEqual(Color.White, C); //even point with resources w.tryToBuildAtIntersection(new Point(0, 3)); C = w.roadButtonClicked(new Point(0, 0)); Assert.AreEqual(Color.HotPink, C); //odd point with resources w.tryToBuildAtIntersection(new Point(1, 5)); C = w.roadButtonClicked(new Point(3, 2)); Assert.AreEqual(Color.HotPink, C); //point that is not in the grid C = w.roadButtonClicked(new Point(50, 2)); Assert.AreEqual(Color.White, C); //point that has not been initialized w.catanMap = null; C = w.roadButtonClicked(new Point(3, 2)); Assert.AreEqual(Color.Black, C); }