public void TestTerritoriesHaveTheCorrectContinent()
        {
            DataHandler dh = new DataHandler();
            List<Territory> territories = dh.loadTerritories();

            // check that the territories have the correct continent id
            // don't bother checking all 40 territories, but two or three
            // from each continent

            // north america
            Assert.AreEqual(1, territories[0].continentId);
            Assert.AreEqual(1, territories[8].continentId);

            // europa
            Assert.AreEqual(2, territories[9].continentId);
            Assert.AreEqual(2, territories[15].continentId);

            // south america
            Assert.AreEqual(5, territories[16].continentId);
            Assert.AreEqual(5, territories[19].continentId);

            // africa
            Assert.AreEqual(3, territories[20].continentId);
            Assert.AreEqual(3, territories[25].continentId);

            // asia
            Assert.AreEqual(0, territories[26].continentId);
            Assert.AreEqual(0, territories[36].continentId);

            // australia
            Assert.AreEqual(4, territories[37].continentId);
            Assert.AreEqual(4, territories[40].continentId);
        }
        public void TestContinetsHasRightTerritories()
        {
            DataHandler dh = new DataHandler();
            List<Continent> continents = dh.loadContinents();

            // optimally, each continent has a list of territories
            // and all territories could be easily found simply
            // by going through all continents instead of having to lists

            // Asia id 0, should have 10 territories
            Assert.AreEqual(11, continents[0].Territories.Count);

            // north america should have 9
            Assert.AreEqual(9, continents[1].Territories.Count);

            // europe
            Assert.AreEqual(7, continents[2].Territories.Count);

            // africa
            Assert.AreEqual(6, continents[3].Territories.Count);

            // australia
            Assert.AreEqual(4, continents[4].Territories.Count);

            // south america
            Assert.AreEqual(4, continents[5].Territories.Count);
        }
        public void TestLoadTerritories()
        {
            DataHandler dh = new DataHandler();
            List<Territory> territories = dh.loadTerritories();

            // check that the first ones are correct
            Assert.AreEqual("Klodike", territories[0].name);
            Assert.AreEqual("Nunavut", territories[1].name);
            Assert.AreEqual("Greenland", territories[2].name);
            Assert.AreEqual("Pacifica", territories[3].name);
        }
        public void TestLoadContinents()
        {
            DataHandler dh = new DataHandler();
            List<Continent> continents = dh.loadContinents();

            // check amount of territories in each continent
            Assert.AreEqual(6, continents.Count);
            Assert.AreEqual("Asia", continents[0].name);
            Assert.AreEqual("North America", continents[1].name);
            Assert.AreEqual("Europe", continents[2].name);
            Assert.AreEqual("Africa", continents[3].name);
            Assert.AreEqual("Australia", continents[4].name);
            Assert.AreEqual("South America", continents[5].name);
        }
Exemple #5
0
        public Game()
        {
            dh = new DataHandler();

            // set game state to select
            gameState = State.waiting;

            this.maxPlayers = 2;
            this.name = "World war 2";

            // load continents and territories
            Continents = dh.loadContinents();

            // setup an empty list of players
            players = new List<Player>();
        }
Exemple #6
0
        public Game(string name, int maxPlayers)
        {
            dh = new DataHandler();
            chat = new Chat();

            // set game state to select
            gameState = State.waiting;

            this.maxPlayers = maxPlayers;
            this.name = name;

            // load continents and territories
            Continents = dh.loadContinents();

            // setup an empty list of players
            players = new List<Player>();
        }