public void ParseModule(string[] dirs, String module, Dictionary <string, string> prefix, Dictionary <string, string> postfix, Dictionary <string, string> country, Dictionary <string, string> region, string pattern, CSVDumper dumper) { switch (module) { case ModuleDirs.Name.CLASS: Console.WriteLine("[Parsing CLASS ...]"); List <ClassData> classes = DirParser.Parse(dirs, ModuleDirs.GetModuleDir(module), prefix, postfix, country, region, ClassData.Parse, pattern); dumper.Dump(classes); break; case ModuleDirs.Name.TABLE: Console.WriteLine("[Parsing TABLE ...]"); List <TableData> tables = DirParser.Parse(dirs, ModuleDirs.GetModuleDir(module), prefix, postfix, country, region, TableData.Parse, pattern); dumper.Dump(tables); break; case ModuleDirs.Name.FORM: Console.WriteLine("[Parsing FORM ...]"); List <FormData> forms = DirParser.Parse(dirs, ModuleDirs.GetModuleDir(module), prefix, postfix, country, region, FormData.Parse, pattern); dumper.Dump(forms); break; case ModuleDirs.Name.ENUM: Console.WriteLine("[Parsing ENUM ...]"); List <EnumData> enums = DirParser.Parse(dirs, ModuleDirs.GetModuleDir(module), prefix, postfix, country, region, EnumData.Parse, pattern); dumper.Dump(enums); break; case ModuleDirs.Name.MAP: Console.WriteLine("[Parsing MAP ...]"); List <MapData> maps = DirParser.Parse(dirs, ModuleDirs.GetModuleDir(module), prefix, postfix, country, region, MapData.Parse, pattern); dumper.Dump(maps); break; case ModuleDirs.Name.QUERY: Console.WriteLine("[Parsing QUERY ...]"); List <QueryData> queries = DirParser.Parse(dirs, ModuleDirs.GetModuleDir(module), prefix, postfix, country, region, QueryData.Parse, pattern); dumper.Dump(queries); break; case ModuleDirs.Name.VIEW: Console.WriteLine("[Parsing VIEW ...]"); List <ViewData> views = DirParser.Parse(dirs, ModuleDirs.GetModuleDir(module), prefix, postfix, country, region, ViewData.Parse, pattern); dumper.Dump(views); break; case ModuleDirs.Name.SSRS: Console.WriteLine("[Parsing SSRS ...]"); List <SSRSData> ssrs = DirParser.Parse(dirs, ModuleDirs.GetModuleDir(module), prefix, postfix, country, region, SSRSData.Parse, pattern); dumper.Dump(ssrs); break; } }
public void DirParser_Happy_Path() { var expectedFileNames = new List <string>() { "test-file.txt", "test-sub-dir-file.txt" }; dirParser = new DirParser("test-dirParser"); var files = dirParser.FileList; var actualFileNames = new List <string>(); foreach (var file in files) { actualFileNames.Add(Path.GetFileName(file)); } Assert.IsTrue(expectedFileNames.SequenceEqual(actualFileNames)); }
public void FileProcessor_Happy_Path() { var dirParser = new DirParser("test-data"); var files = dirParser.FileList; var fileProcessor = new FileProcessor(files); fileProcessor.ProcessFiles(); var saver = new FileProcessor.ResultsSaver(ref fileProcessor); saver.SaveResults(); var actualOutput = Extensions.FileLines("output.txt"); var expectedOutput = new List <string>() { "БРЕСТ, 800", "МИНСК, 650" }; Assert.IsTrue(expectedOutput.SequenceEqual(actualOutput)); }