示例#1
0
        /// <summary>
        /// Test a particular type of file with a particular representation of graph
        /// </summary>
        /// <param name="graphRepresentation">representation of graph</param>
        /// <param name="pathEnum">type of file</param>
        /// <returns>report</returns>
        public StringBuilder Test(Graph.Graph.GraphRepresentationEnum graphRepresentation, PathEnum pathEnum)
        {
            stringBuilder.Clear();

            Testing(graphRepresentation, pathEnum);

            return(stringBuilder);
        }
示例#2
0
        private void Testing(Graph.Graph.GraphRepresentationEnum graphEnum, PathEnum pathEnum)
        {
            try
            {
                List <string> fileList = new List <string>();
                switch (graphEnum)
                {
                case Graph.Graph.GraphRepresentationEnum.adjacencyList:
                    fileList = testsGraphAdjacencyListDictionary[pathEnum];
                    break;

                case Graph.Graph.GraphRepresentationEnum.adjacencyMatrix:
                    fileList = testsGraphAdjacencyMatrixDictionary[pathEnum];
                    break;

                case Graph.Graph.GraphRepresentationEnum.edgeList:
                    fileList = testsGraphEdgeListDictionary[pathEnum];
                    break;

                default:
                    throw new MyException.TestsException.TestsMissingTestException(graphEnum.ToString());
                }
                foreach (string file in fileList)
                {
                    reader = new ReaderGraph(ReaderWriter.CreateTestFile(file), false);
                    Testing();
                }
            }
            catch (KeyNotFoundException)
            {
                throw new MyException.TestsException.TestsMissingTestException(pathEnum.ToString());
            }
            catch (MyException.ReaderWriterException.ReaderWriterException e)
            {
                stringBuilder.AppendLine(e.Message);
            }
        }