Exemple #1
0
        public SourceCodeInfo GetSourceCodeInfo(string rootDir, string proName)
        {
            log.Debug(new { rootDir, proName });

            var sourceCodeInfo = new SourceCodeInfo(rootDir);

            var fullProjPath = Path.Combine(rootDir, proName);

            List <string> csFiles = new List <string>()
            {
            };

            try
            {
                log.Debug("Attempting to analyze CSPROJ and fetch code files");
                csFiles = cSFilesLister.GetCSCodeFiles(fullProjPath);
                log.InfoFormat("Found {0} CS Code files in this project", csFiles.Count);
                log.Debug(csFiles.ToArray());
            }
            catch (Exception e)
            {
                log.Error("Error in analyzing CSPROJ", e);
            }

            foreach (var item in csFiles)
            {
                sourceCodeInfo.AddCodeFile(item);
            }

            return(sourceCodeInfo);
        }
        private void RunListerTests(ICSFilesLister lister, string projPath, List <string> expectedFiles, int expCount = -1)
        {
            var csFiles = lister.GetCSCodeFiles(projPath);


            foreach (var expFile in expectedFiles)
            {
                Assert.IsTrue(csFiles.Contains(expFile));
            }

            if (expCount == -1)
            {
                Assert.IsTrue(csFiles.Count == expectedFiles.Count);
                foreach (var expFile in csFiles)
                {
                    Assert.IsTrue(expectedFiles.Contains(expFile));
                }
            }
            else
            {
                Assert.IsTrue(csFiles.Count == expCount);
            }
        }