Ejemplo n.º 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");
        }
Ejemplo n.º 2
0
        public void TEST_NETCORE_CSPROJ()
        {
            //Assign
            string  input_Content = "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  <PropertyGroup>\r\n    <OutputType>Library</OutputType>\r\n    <TargetFramework>netcoreapp2.0</TargetFramework>\r\n    <ApplicationIcon />\r\n    <StartupObject />\r\n  </PropertyGroup>\r\n\r\n  <ItemGroup>\r\n    <ProjectReference Include=\"..\\..\\Core\\DirParser.Core\\DirParser.Core.csproj\" />\r\n  </ItemGroup>\r\n\r\n</Project>\r\n";
            string  input_Name    = "test.csproj";
            DirFile input         = new DirFile(input_Name, input_Content);

            ProjectParseReport output;
            ProjectParseReport expectedOutput = new ProjectParseReport("test", new ReferenceParseReport[] { new ReferenceParseReport("DirParser.Core", "csproj") });

            IProjectParser actor = new NETCoreProjectParser();

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

            //Assert
            output.ShouldDeepEqual(expectedOutput);
        }