Beispiel #1
0
        public void CreateCityManagerAndPopulateWithCitiesTest()
        {
            // Cities we want managed
            City.City city1 = new City.City(500000);
            City.City city2 = new City.City(2500000);
            City.City city3 = new City.City(40000);

            Assert.IsNotNull(city1);
            Assert.IsNotNull(city2);
            Assert.IsNotNull(city3);

            // Add them to city manager
            CityManager cityManager = new CityManager();

            // List of cities should be instantiated when a citymanager is created
            Assert.IsNotNull(cityManager);
            Assert.IsNotNull(cityManager.Cities);

            cityManager.Add(city1);
            cityManager.Add(city2);
            cityManager.Add(city3);

            Assert.AreEqual(3, cityManager.Cities.Count, "City Manager did not add cities correctly");
            Assert.AreEqual(city1, cityManager.Cities[0], "Incorrect city was added to city manager");
            Assert.AreEqual(city2, cityManager.Cities[1], "Incorrect city was added to city manager");
            Assert.AreEqual(city3, cityManager.Cities[2], "Incorrect city was added to city manager");
        }
Beispiel #2
0
        public void CreateCityTest()
        {
            City.City city = new City.City(500000);

            Assert.IsNotNull(city);
            Assert.AreEqual(city.Population, 500000, "Population property was not set correctly");
        }
Beispiel #3
0
 public void SetCity(City.City city, int c, int r)
 {
     using (var mapRender = new MapRenderer(5 * MapRenderer.tileSize, 5 * MapRenderer.tileSize, world))
         cityMap = mapRender.Render((c - 2) * 64, (r - 2) * 64);
     this.city = city;
     this.c    = c;
     this.r    = r;
     Invalidate();
 }