public void GraphParsingTest(string filename, int expectedVertices, int expectedEdges) { string filepath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Templates\" + filename + ".xmile"; var parser = new GraphParser(filepath, false); var graph = parser.CreateGraph("DEFAULT"); Assert.AreEqual(graph.VertexCount, expectedVertices); Assert.AreEqual(graph.EdgeCount, expectedEdges); }
private static void Main(string[] args) { #if DEBUG string filepath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Templates\Borneo.xmile"; #else if (args.Length != 1) { Console.WriteLine("Программе требуется один аргумент командной строки."); Exit(ErrorCode.ArgumentsError); } string filepath = args[0]; #endif Console.WriteLine("Выполнить валидацию XML? (Y/N)"); ConsoleKey key = Console.ReadKey(true).Key; bool shouldValidate = key == ConsoleKey.Y; #if !DEBUG try #endif { Console.WriteLine("Парсинг графа..."); var parser = new GraphParser(filepath, shouldValidate); var graph = parser.CreateGraph("[GLOBAL]"); Console.WriteLine("Граф считан."); Process(graph); } #if !DEBUG catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Exit(ErrorCode.Fail); } #endif Exit(ErrorCode.Success); }