예제 #1
0
        private static void AssertSourceFileName(CoverageDS coverageDS)
        {
            var sourceFileNames = from sourceFilePath in coverageDS.GetSourceFiles()
                                  select Path.GetFileName(sourceFilePath);

            var expectedFileName = "UnitTest1.cs";

            CollectionAssert.Contains(
                sourceFileNames.ToArray(),
                expectedFileName,
                $"Code Coverage not collected for file: {expectedFileName}");
        }
예제 #2
0
        public static void PrintCoverageInfo(CoverageInfo finalCovInfo)
        {
            CoverageDS coverageDS = finalCovInfo.BuildDataSet();

            //Get All Source files from coverage file
            List <string> sourceFiles = coverageDS.GetSourceFiles();

            foreach (string sourceFile in sourceFiles)
            {
                //No need for doing this anymore

                /*List<CoverageDSPriv.LinesRow> allLines = DataRowToList(coverageDS, sourceFile);
                 *
                 * IList<LineCoverageInfo> mergedInfos = CoverageDS.MergeFileLines(allLines);
                 */

                //this is the new API which you can use for each source to get correct coverage info.

                IList <LineCoverageInfo> sortInfo = CoverageDS.GetSourceFileLineCoverageInfo(coverageDS, sourceFile);
                AnalyzeMergedLines(sortInfo);
            }
        }