Пример #1
0
        public List <FileCoverageInfo> GetFileCoverageInfos(List <string> coverageFiles)
        {
            var parseResult = ParseCoverageFiles(coverageFiles);

            List <FileCoverageInfo> fileCoverages = new List <FileCoverageInfo>();

            foreach (var assembly in parseResult.Assemblies)
            {
                foreach (var @class in assembly.Classes)
                {
                    foreach (var file in @class.Files)
                    {
                        FileCoverageInfo resultFileCoverageInfo = new FileCoverageInfo {
                            FilePath = file.Path, LineCoverageStatus = new Dictionary <uint, CoverageStatus>()
                        };
                        int lineNumber = 0;

                        foreach (var line in file.LineCoverage)
                        {
                            if (line != -1 && lineNumber != 0)
                            {
                                resultFileCoverageInfo.LineCoverageStatus.Add((uint)lineNumber, line == 0 ? CoverageStatus.NotCovered : CoverageStatus.Covered);
                            }
                            ++lineNumber;
                        }

                        fileCoverages.Add(resultFileCoverageInfo);
                    }
                }
            }

            return(fileCoverages);
        }
Пример #2
0
        public List <FileCoverageInfo> GetFileCoverageInfos()
        {
            TraceLogger.Debug("ReportGeneratorTool.GetFileCoverageInfos: Generating file coverage info from coverage files.");

            List <FileCoverageInfo> fileCoverages = new List <FileCoverageInfo>();

            if (Configuration.CoverageFiles == null)
            {
                return(fileCoverages);
            }

            foreach (var assembly in _parserResult.Assemblies)
            {
                foreach (var @class in assembly.Classes)
                {
                    foreach (var file in @class.Files)
                    {
                        FileCoverageInfo resultFileCoverageInfo = new FileCoverageInfo {
                            FilePath = file.Path, LineCoverageStatus = new Dictionary <uint, CoverageStatus>()
                        };
                        int lineNumber = 0;

                        foreach (var line in file.LineCoverage)
                        {
                            if (line != -1 && lineNumber != 0)
                            {
                                resultFileCoverageInfo.LineCoverageStatus.Add((uint)lineNumber, line == 0 ? CoverageStatus.NotCovered : CoverageStatus.Covered);
                            }
                            ++lineNumber;
                        }

                        fileCoverages.Add(resultFileCoverageInfo);
                    }
                }
            }

            return(fileCoverages);
        }