예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
 public void TestGameGetTerritory()
 {
     Game game = new Game("world war 2", 2);
     Assert.AreEqual("Greenland", game.getTerritory(2).name);
 }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }