public void TestBorderingToEachOtherNorthAmerica() { Game game = new Game("world war 2", 2); Territory t1 = game.getTerritory(1); Territory t2 = game.getTerritory(2); Territory t3 = game.getTerritory(3); Territory t4 = game.getTerritory(4); Territory t5 = game.getTerritory(5); Territory t6 = game.getTerritory(6); Territory t7 = game.getTerritory(7); Territory t8 = game.getTerritory(8); Territory t9 = game.getTerritory(9); Assert.IsTrue(game.territoryBorderToEachOther(t1, t3)); Assert.IsTrue(game.territoryBorderToEachOther(t1, t7)); Assert.IsTrue(game.territoryBorderToEachOther(t1, t2)); Assert.IsTrue(game.territoryBorderToEachOther(t4, t5)); Assert.IsTrue(game.territoryBorderToEachOther(t4, t7)); Assert.IsTrue(game.territoryBorderToEachOther(t4, t3)); Assert.IsTrue(game.territoryBorderToEachOther(t7, t1)); Assert.IsTrue(game.territoryBorderToEachOther(t7, t2)); Assert.IsTrue(game.territoryBorderToEachOther(t7, t8)); Assert.IsFalse(game.territoryBorderToEachOther(t1, t4)); Assert.IsFalse(game.territoryBorderToEachOther(t1, t8)); Assert.IsFalse(game.territoryBorderToEachOther(t1, t9)); Assert.IsFalse(game.territoryBorderToEachOther(t8, t1)); Assert.IsFalse(game.territoryBorderToEachOther(t8, t8)); Assert.IsFalse(game.territoryBorderToEachOther(t8, t9)); }
public void TestBorderingToEachOtherEuropa() { Game game = new Game("world war 2", 2); Territory t9 = game.getTerritory(9); Territory t10 = game.getTerritory(10); Territory t11 = game.getTerritory(11); Territory t12 = game.getTerritory(12); Territory t13 = game.getTerritory(13); Territory t14 = game.getTerritory(14); Territory t15 = game.getTerritory(15); Territory t2 = game.getTerritory(2); // test 10 and 12 Assert.IsTrue(game.territoryBorderToEachOther(t10, t9)); Assert.IsTrue(game.territoryBorderToEachOther(t10, t11)); Assert.IsTrue(game.territoryBorderToEachOther(t10, t12)); Assert.IsTrue(game.territoryBorderToEachOther(t10, t14)); Assert.IsTrue(game.territoryBorderToEachOther(t10, t15)); Assert.IsFalse(game.territoryBorderToEachOther(t10, t13)); Assert.IsTrue(game.territoryBorderToEachOther(t12, t13)); Assert.IsTrue(game.territoryBorderToEachOther(t12, t11)); Assert.IsTrue(game.territoryBorderToEachOther(t12, t14)); }
public void TestGameLoadTerriories() { Game g = new Game("world war 2", 2); List<Territory> territories = g.getAllTerritories(); // should be 40 territories Assert.AreEqual(40, territories.Count); }
public void TestPlayerControlContinent() { Game game = new Game("world war 2", 2); Player p1 = new Player("jan", Player.playerColor.blue, null); Player p2 = new Player("nils", Player.playerColor.green, null); // set all territories belonging to me for (int i = 0; i < 16; i++) { game.setTerritory(i, p1, 5); } Assert.IsTrue(game.checkIfPlayerControlContinent(p1, game.Continents[1])); Assert.IsTrue(game.checkIfPlayerControlContinent(p1, game.Continents[2])); Assert.IsFalse(game.checkIfPlayerControlContinent(p1, null)); Assert.IsFalse(game.checkIfPlayerControlContinent(null, null)); Assert.IsFalse(game.checkIfPlayerControlContinent(null, game.Continents[1])); Assert.IsFalse(game.checkIfPlayerControlContinent(p2, game.Continents[1])); Assert.IsFalse(game.checkIfPlayerControlContinent(p2, game.Continents[2])); }
public void TestNextPlayersTurn() { Game game = new Game("world war 2", 2); Player p1 = new Player("player1", Player.playerColor.blue, null); Player p2 = new Player("player2", Player.playerColor.green, null); }
public void TestGameGetTerritory() { Game game = new Game("world war 2", 2); Assert.AreEqual("Greenland", game.getTerritory(2).name); }
public void TestSetupNeighbours2() { Game game = new Game("world war 2", 2); Territory temp = game.getTerritory(1); Assert.IsTrue(temp.borderingToTerritoryId.Contains(0)); Assert.IsTrue(temp.borderingToTerritoryId.Contains(3)); Assert.IsTrue(temp.borderingToTerritoryId.Contains(7)); Assert.IsTrue(temp.borderingToTerritoryId.Contains(2)); temp = game.getTerritory(3); Assert.IsTrue(temp.borderingToTerritoryId.Contains(0)); Assert.IsTrue(temp.borderingToTerritoryId.Contains(1)); Assert.IsTrue(temp.borderingToTerritoryId.Contains(7)); Assert.IsTrue(temp.borderingToTerritoryId.Contains(4)); // check if territories have the correct amount of bordering territories temp = game.getTerritory(4); Assert.AreEqual(4, temp.borderingToTerritoryId.Count); temp = game.getTerritory(5); Assert.AreEqual(4, temp.borderingToTerritoryId.Count); temp = game.getTerritory(7); Assert.AreEqual(6, temp.borderingToTerritoryId.Count); temp = game.getTerritory(8); Assert.AreEqual(3, temp.borderingToTerritoryId.Count); }
public void TestSetupNeighbours() { Game game = new Game("world war 2", 2); Territory temp = game.getTerritory(1); Assert.AreEqual(4, temp.borderingToTerritoryId.Count); temp = game.getTerritory(3); Assert.AreEqual(4, temp.borderingToTerritoryId.Count); }
public void TestPlayerHasWon3() { Game game = new Game("world war 2", 2); Player p1 = new Player("jan", Player.playerColor.blue, null); Player p2 = new Player("nils", Player.playerColor.green, null); game.activePlayer = p1; for (int i = 0; i < 16; i++) { game.setTerritory(i, p1, 5); } game.setTerritory(10, p2, 5); Assert.IsFalse(game.checkIfActivePlayerIsHasWon()); game.activePlayer = p2; Assert.IsFalse(game.checkIfActivePlayerIsHasWon()); }
public void TestPlayerHasLost2() { Game game = new Game("world war 2", 4); Player p1 = new Player("jan", Player.playerColor.blue, null); Player p2 = new Player("nils", Player.playerColor.green, null); Player p3 = new Player("peter", Player.playerColor.green, null); Player p4 = new Player("arne", Player.playerColor.green, null); Assert.IsTrue(game.addPlayer(p1, true)); Assert.IsTrue(game.addPlayer(p2, true)); Assert.IsTrue(game.addPlayer(p3, true)); Assert.IsTrue(game.addPlayer(p4, true)); for (int i = 0; i < 16; i++) { game.setTerritory(i, p1, 5); } game.setTerritory(10, p3, 4); Assert.IsTrue(game.playerExist(p1.nickname).alive); Assert.IsTrue(game.playerExist(p2.nickname).alive); Assert.IsTrue(game.playerExist(p3.nickname).alive); Assert.IsTrue(game.playerExist(p4.nickname).alive); // p2 owns no territories and should be "dead" game.checkIfPlayerHasLost(); Assert.IsTrue(game.playerExist(p1.nickname).alive); Assert.IsFalse(game.playerExist(p2.nickname).alive); Assert.IsTrue(game.playerExist(p3.nickname).alive); Assert.IsFalse(game.playerExist(p4.nickname).alive); }
public void TestPlayerDead() { Game game = new Game("world war 2", 2); Player p1 = new Player("jan", Player.playerColor.blue, null); Player p2 = new Player("nils", Player.playerColor.green, null); Assert.IsTrue(game.addPlayer(p1, true)); Assert.IsTrue(game.addPlayer(p2, true)); Assert.IsTrue(game.playerExist(p2.nickname).alive); Assert.IsTrue(game.playerExist(p1.nickname).alive); game.setPlayerStatus(p2, false); Assert.IsFalse(game.playerExist(p2.nickname).alive); Assert.IsTrue(game.playerExist(p1.nickname).alive); }