private void Testing(PathEnum pathEnum) { try { string path = testsDictionary[pathEnum]; readerWriter = new ReaderGraph(path); Testing(); } catch (KeyNotFoundException) { throw new MyException.TestsException.TestsMissingTestException(pathEnum.ToString()); } catch (MyException.ReaderWriterException.ReaderWriterException e) { stringBuilder.AppendLine(e.Message); } }
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); } }
private void Testing(PathEnum pathEnum) { try { Graph.IGraphInterface graph; GraphColoringAlgorithm.SequenceAlgorithm.RandomSequence.RandomSequence randomSequence; GraphColoringAlgorithm.SequenceAlgorithm.LargestFirstSequence.LargestFirstSequence largestFirstSequence; testPath = ReaderWriter.CreateTestFile(testsDictionary[pathEnum]); reader = new ReaderGraph(testPath, false); writer = new WriterGraph(testPath, false); stringBuilder.AppendLine(pathEnum.ToString()); try { switch (pathEnum) { case PathEnum.write: graph = reader.ReadFile(); randomSequence = new GraphColoringAlgorithm.SequenceAlgorithm.RandomSequence.RandomSequence(graph); randomSequence.Color(); writer.WriteFileColor(graph, GraphColoringAlgorithm.GraphColoringAlgorithm.GraphColoringAlgorithmEnum.randomSequence, false); reader.ReadFile(); stringBuilder.AppendLine("OK"); break; case PathEnum.recordExists: graph = reader.ReadFile(); largestFirstSequence = new GraphColoringAlgorithm.SequenceAlgorithm.LargestFirstSequence.LargestFirstSequence(graph); largestFirstSequence.Color(); if (!writer.WriteFileColor(graph, GraphColoringAlgorithm.GraphColoringAlgorithm.GraphColoringAlgorithmEnum.largestFirstSequence, false)) { stringBuilder.AppendLine("OK"); } else { stringBuilder.AppendLine("NOK"); } reader.ReadFile(); break; case PathEnum.first: graph = reader.ReadFile(); randomSequence = new GraphColoringAlgorithm.SequenceAlgorithm.RandomSequence.RandomSequence(graph); randomSequence.Color(); writer.WriteFileColor(graph, GraphColoringAlgorithm.GraphColoringAlgorithm.GraphColoringAlgorithmEnum.randomSequence, false); reader.ReadFile(); stringBuilder.AppendLine("OK"); break; default: stringBuilder.AppendLine("This pathEnum isn't implemented!"); break; } } catch (MyException.ReaderWriterException.ReaderWriterException e) { stringBuilder.AppendLine(e.Message); } catch (MyException.GraphException.GraphException e) { stringBuilder.AppendLine(e.Message); } } catch (KeyNotFoundException) { throw new MyException.TestsException.TestsMissingTestException(pathEnum.ToString()); } catch (MyException.ReaderWriterException.ReaderWriterException e) { stringBuilder.AppendLine(e.Message); } }