Beispiel #1
0
        public void TestFindCitiesByTransportMode()
        {
            Cities cities = new Cities();

            cities.ReadCities(@"citiesTestDataLab3.txt");
            var routes = new Links(cities);

            routes.ReadLinks(@"linksTestDataLab3.txt");

            City[] citiesByMode = routes.FindCities(TransportMode.Rail);
            Assert.AreEqual(11, citiesByMode.Length);

            City[] emptyCitiesByMode = routes.FindCities(TransportMode.Bus);
            Assert.AreEqual(0, emptyCitiesByMode.Length);
        }
Beispiel #2
0
        public void TestFindCitiesByTransportMode()
        {
            Cities cities = new Cities();

            cities.ReadCities(@"citiesTestDataLab3.txt");
            var routes = new Links(cities);

            // run on empty lists
            City[] emptyCitiesByMode = routes.FindCities(TransportMode.Bus);
            Assert.AreEqual(0, emptyCitiesByMode.Length);

            // now read links
            routes.ReadLinks(@"linksTestDataLab3.txt");

            // run tests on non empty lists
            City[] citiesByMode = routes.FindCities(TransportMode.Rail);
            Assert.AreEqual(11, citiesByMode.Length);

            emptyCitiesByMode = routes.FindCities(TransportMode.Bus);
            Assert.AreEqual(0, emptyCitiesByMode.Length);

            emptyCitiesByMode = routes.FindCities((TransportMode)99);
            Assert.AreEqual(0, emptyCitiesByMode.Length);
        }