Beispiel #1
0
        public static void Main(string[] args)
        {
            string root = args[0];

            IFileReader       fileReader       = new FileReader();
            IDirectoryBrowser directoryBrowser = new DirectoryBrowser(root, fileReader, new string[] { "node_modules", "$tf", "packages" });

            IDatabaseParser  efDatabaseParser = new EntityFrameworkDatabaseParser();
            IProcedureParser procedureParser  = new InformixProcedureParser();

            IFileParser csFileParser  = new CSFileParser(efDatabaseParser);
            IFileParser sqlFileParser = new SQLFileParser(procedureParser);

            IProjectParser netCoreProjectParser = new NETCoreProjectParser(csFileParser);

            List <ProcedureParseReport> procedureList = new List <ProcedureParseReport>();
            List <ProjectParseReport>   projectList   = new List <ProjectParseReport>();

            int total = 0;

            DirFile file;

            while ((file = directoryBrowser.NextFile()) != null)
            {
                if (file.Extension == "csproj")
                {
                    ProjectParseReport projectReport = netCoreProjectParser.Parse(file);

                    if (projectReport != null)
                    {
                        projectList.Add(projectReport);
                    }
                }
                else if (file.Extension == "sql")
                {
                    FileParseReport procedureReport = sqlFileParser.Parse(file);

                    if (procedureReport != null)
                    {
                        procedureList.AddRange(procedureReport.Procedures);
                    }
                }

                total++;
                UpdateConsoleStatus(total, file.Path, root);
            }

            JsonFileWriter.WriteToFile(procedureList, "procedureReport.json");
            JsonFileWriter.WriteToFile(projectList, "projectReport.json");
        }
Beispiel #2
0
        public void TEST_EMPTY_REPORT()
        {
            //Assign
            string input_Content = "";

            DatabaseParseReport output;
            DatabaseParseReport expectedOutput = new DatabaseParseReport(null);

            IDatabaseParser actor = new EntityFrameworkDatabaseParser();

            //Act
            //output = actor.Parse(input_Content);

            //Assert
            //output.ShouldDeepEqual(expectedOutput);
        }
Beispiel #3
0
        public void TEST_ONLY_ONE_TABLE_NAME()
        {
            //Assign
            string input_Content = "ToTable(\"testtablename\",\"informix\");";

            string output;
            string expectedOutput = "testtablename";

            IDatabaseParser actor = new EntityFrameworkDatabaseParser();

            //Act
            //DatabaseParseReport dpr = actor.Parse(input_Content);
            //output = dpr.Tables.First().Name;

            //Assert
            //Assert.AreEqual(expectedOutput, output);
        }