Exemplo n.º 1
0
 public void TestLoadingData()
 {
     BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
     String actual = alg.start();
     String Expected = "success";
     Assert.AreEqual(actual, Expected);
 }
Exemplo n.º 2
0
        public void TestLoadingData()
        {
            BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
            String actual   = alg.start();
            String Expected = "success";

            Assert.AreEqual(actual, Expected);
        }
Exemplo n.º 3
0
 public void TestRoutesInPath()
 {
     BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
     alg.start();
     String routeNumber = "002";
     Dictionary<String, BusRouteGuider.View.Route> routes = alg.getAllRoutes();
     String path = routes[routeNumber].getPathForTesting();
     String expected = "Fort->Kiribathgoda->Miriswatha->Nittambuwa->Warakapola->Nelundeniya->Galigamuwa->Kegalle->Mawanella->Kadugannawa->Peradeniya->Kandy";
     Assert.AreEqual(expected, path);
 }
Exemplo n.º 4
0
        public void TestRoutesInPath()
        {
            BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
            alg.start();
            String routeNumber = "002";
            Dictionary <String, BusRouteGuider.View.Route> routes = alg.getAllRoutes();
            String path     = routes[routeNumber].getPathForTesting();
            String expected = "Fort->Kiribathgoda->Miriswatha->Nittambuwa->Warakapola->Nelundeniya->Galigamuwa->Kegalle->Mawanella->Kadugannawa->Peradeniya->Kandy";

            Assert.AreEqual(expected, path);
        }
Exemplo n.º 5
0
 public void TestLocationFunctionality()
 {
     BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
     String actual = "";
     String expected = "success";
     Dictionary<String, BusRouteGuider.View.Location> locations = alg.getAllLocations();
     if (locations.ContainsKey("Warakapola"))
     {
         actual = "success";
     }
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 6
0
 public void TestRouteDictionary()
 {
     BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
     String routeIn = "Fort,Kiribathgoda,Miriswatha,Nittambuwa,Warakapola,Nelundeniya,Galigamuwa,Kegalle,Mawanella,Kadugannawa,Peradeniya,Kandy";
     String routeOut = "Kandy,Peradeniya,Kadugannawa,Mawanella,Kegalle,Galigamuwa,Nelundeniya,Warakapola,Nittambuwa,Miriswatha,Kiribathgoda,Fort";
     String expectedRoute = "Fort->Kiribathgoda->Miriswatha->Nittambuwa->Warakapola->Nelundeniya->Galigamuwa->Kegalle->Mawanella->Kadugannawa->Peradeniya->Kandy";
     String routeNumber = "001";
     BusRouteGuider.View.Route route = new BusRouteGuider.View.Route(routeNumber);
     route = alg.processInput(routeIn, route);
     route = alg.processInput(routeOut, route);
     Assert.AreEqual(route.getPath(), expectedRoute);
 }
Exemplo n.º 7
0
        public void TestLocationFunctionality()
        {
            BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
            String actual   = "";
            String expected = "success";
            Dictionary <String, BusRouteGuider.View.Location> locations = alg.getAllLocations();

            if (locations.ContainsKey("Warakapola"))
            {
                actual = "success";
            }
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 8
0
        public void TestRouteDictionary()
        {
            BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
            String routeIn       = "Fort,Kiribathgoda,Miriswatha,Nittambuwa,Warakapola,Nelundeniya,Galigamuwa,Kegalle,Mawanella,Kadugannawa,Peradeniya,Kandy";
            String routeOut      = "Kandy,Peradeniya,Kadugannawa,Mawanella,Kegalle,Galigamuwa,Nelundeniya,Warakapola,Nittambuwa,Miriswatha,Kiribathgoda,Fort";
            String expectedRoute = "Fort->Kiribathgoda->Miriswatha->Nittambuwa->Warakapola->Nelundeniya->Galigamuwa->Kegalle->Mawanella->Kadugannawa->Peradeniya->Kandy";
            String routeNumber   = "001";

            BusRouteGuider.View.Route route = new BusRouteGuider.View.Route(routeNumber);
            route = alg.processInput(routeIn, route);
            route = alg.processInput(routeOut, route);
            Assert.AreEqual(route.getPath(), expectedRoute);
        }
Exemplo n.º 9
0
 public void TestBusesAtALocationFunctionality()
 {
     BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
     String town = "Moratuwa";
     Dictionary<String, BusRouteGuider.View.Location> locations = alg.getAllLocations();
     LinkedList<BusRouteGuider.View.Route> list = locations[town].getRoutes();
     String expected = "success";
     String actual = "";
     foreach (BusRouteGuider.View.Route r in list)
     {
         if (r.getRouteNumber().Equals("430"))
         {
             actual = "success";
         }
     }
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 10
0
        public void TestBusesAtALocationFunctionality()
        {
            BusRouteGuider.View.SearchRoute alg = new BusRouteGuider.View.SearchRoute();
            String town = "Moratuwa";
            Dictionary <String, BusRouteGuider.View.Location> locations = alg.getAllLocations();
            LinkedList <BusRouteGuider.View.Route>            list      = locations[town].getRoutes();
            String expected = "success";
            String actual   = "";

            foreach (BusRouteGuider.View.Route r in list)
            {
                if (r.getRouteNumber().Equals("430"))
                {
                    actual = "success";
                }
            }
            Assert.AreEqual(expected, actual);
        }