Exemplo n.º 1
0
        public override void Run(string[] args = null)
        {
            if (args == null || args.Length != 2)
            {
                printFailure("Usage: SubwayTester [startStation] [endStation]");
            }
            else
            {
                try
                {
                    SubwayLoader loader = new SubwayLoader();
                    Subway objectville = loader.loadFromFile("ObjectvilleSubway.txt");

                    runTest("start/end station", validateStations(objectville, args[0], args[1]));

                    List<Connection> route = objectville.GetDirections(args[0], args[1]);
                    SubwayPrinter printer = new SubwayPrinter();
                    printer.PrintDirections(route);
                    Console.WriteLine(printer.output);
                }
                catch (Exception e)
                {
                    printFailure("Every");
                    Console.WriteLine(e.Message);
                    Console.WriteLine(e.StackTrace);
                }
            }
            
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public void RunLoadTests()
        {
            try
            {
                SubwayLoader loader = new SubwayLoader();
                Subway objectville = loader.loadFromFile("ObjectvilleSubway.txt");

                runTest("station", validateStations(objectville));
                runTest("connection", validateConnections(objectville));
            }
            catch (Exception e)
            {
                printFailure("All");
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }

            Console.ReadKey();
        }