예제 #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();
        }
예제 #2
0
        public override void Run(string[] args = null)
        {
            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();
        }